mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
#132 Temporal hack to run with Go1.5
This commit is contained in:
parent
0bc321d3ef
commit
633ee4096e
@ -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).
|
||||
|
@ -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"
|
||||
)
|
||||
|
@ -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.
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
|
2
image.go
2
image.go
@ -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"
|
||||
)
|
||||
|
@ -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 {
|
||||
|
@ -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"
|
||||
)
|
||||
|
@ -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)
|
@ -15,7 +15,7 @@
|
||||
package graphics
|
||||
|
||||
import (
|
||||
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
|
||||
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
|
||||
"math"
|
||||
)
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
package graphics
|
||||
|
||||
import (
|
||||
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
|
||||
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
@ -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"
|
||||
)
|
||||
|
@ -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
6
run.go
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user