#132 Temporal hack to run with Go1.5

This commit is contained in:
Hajime Hoshi 2015-07-22 23:27:50 +09:00
parent 0bc321d3ef
commit 633ee4096e
20 changed files with 30 additions and 14 deletions

View File

@ -15,7 +15,7 @@
package audio
import (
"github.com/hajimehoshi/ebiten/exp/audio/internal"
"github.com/hajimehoshi/ebiten/exp/audio/inner"
)
// SampleRate returns the sampling frequency (e.g. 44100).

View File

@ -15,9 +15,9 @@
package ebiten
import (
audio "github.com/hajimehoshi/ebiten/exp/audio/internal"
audio "github.com/hajimehoshi/ebiten/exp/audio/inner"
"github.com/hajimehoshi/ebiten/internal/graphics"
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
"github.com/hajimehoshi/ebiten/internal/ui"
"image"
)

View File

@ -15,7 +15,7 @@
package ebiten
import (
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
)
// Filter represents the type of filter to be used when an image is maginified or minified.

View File

@ -16,7 +16,7 @@ package ebiten
import (
"github.com/hajimehoshi/ebiten/internal/graphics"
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
"github.com/hajimehoshi/ebiten/internal/ui"
)

View File

@ -18,7 +18,7 @@ import (
"errors"
"fmt"
"github.com/hajimehoshi/ebiten/internal/graphics"
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
"image"
"image/color"
)

View File

@ -17,7 +17,7 @@ package graphics
import (
"errors"
"fmt"
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
)
func glMatrix(m *[4][4]float64) []float32 {

View File

@ -15,7 +15,7 @@
package graphics
import (
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
"image/color"
"math"
)

View File

@ -73,6 +73,12 @@ func (c *Context) init() {
gl.BlendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA)
}
func (c *Context) Check() {
if e := gl.GetError(); e != gl.NO_ERROR {
panic(fmt.Sprintf("check failed: %d", e))
}
}
func (c *Context) NewTexture(width, height int, pixels []uint8, filter Filter) (Texture, error) {
var t uint32
gl.GenTextures(1, &t)

View File

@ -15,7 +15,7 @@
package graphics
import (
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
"math"
)

View File

@ -15,7 +15,7 @@
package graphics
import (
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
"strings"
)

View File

@ -16,7 +16,7 @@ package graphics
import (
"errors"
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
"image"
"image/draw"
)

View File

@ -64,10 +64,16 @@ func Init() {
func ExecOnUIThread(f func()) {
ch := make(chan struct{})
currentUI.funcs <- func() {
/*currentUI.funcs <- func() {
defer close(ch)
f()
}
}*/
go func() {
defer close(ch)
runtime.LockOSThread()
currentUI.window.MakeContextCurrent()
f()
}()
<-ch
}

6
run.go
View File

@ -15,7 +15,7 @@
package ebiten
import (
audio "github.com/hajimehoshi/ebiten/exp/audio/internal"
audio "github.com/hajimehoshi/ebiten/exp/audio/inner"
"github.com/hajimehoshi/ebiten/internal/ui"
"time"
)
@ -54,6 +54,10 @@ func Run(f func(*Image) error, width, height, scale int, title string) error {
}
defer ui.Terminate()
ui.ExecOnUIThread(func() {
glContext.Check()
})
graphicsContext, err := newGraphicsContext(width, height, actualScale)
if err != nil {
return err