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
|
package audio
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/exp/audio/internal"
|
"github.com/hajimehoshi/ebiten/exp/audio/inner"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SampleRate returns the sampling frequency (e.g. 44100).
|
// SampleRate returns the sampling frequency (e.g. 44100).
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
package ebiten
|
package ebiten
|
||||||
|
|
||||||
import (
|
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"
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
|
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
|
||||||
"github.com/hajimehoshi/ebiten/internal/ui"
|
"github.com/hajimehoshi/ebiten/internal/ui"
|
||||||
"image"
|
"image"
|
||||||
)
|
)
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
package ebiten
|
package ebiten
|
||||||
|
|
||||||
import (
|
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.
|
// Filter represents the type of filter to be used when an image is maginified or minified.
|
||||||
|
@ -16,7 +16,7 @@ package ebiten
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphics"
|
"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"
|
"github.com/hajimehoshi/ebiten/internal/ui"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
2
image.go
2
image.go
@ -18,7 +18,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphics"
|
"github.com/hajimehoshi/ebiten/internal/graphics"
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
|
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
)
|
)
|
||||||
|
@ -17,7 +17,7 @@ package graphics
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
|
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
|
||||||
)
|
)
|
||||||
|
|
||||||
func glMatrix(m *[4][4]float64) []float32 {
|
func glMatrix(m *[4][4]float64) []float32 {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
package graphics
|
package graphics
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
|
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
|
||||||
"image/color"
|
"image/color"
|
||||||
"math"
|
"math"
|
||||||
)
|
)
|
||||||
|
@ -73,6 +73,12 @@ func (c *Context) init() {
|
|||||||
gl.BlendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA)
|
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) {
|
func (c *Context) NewTexture(width, height int, pixels []uint8, filter Filter) (Texture, error) {
|
||||||
var t uint32
|
var t uint32
|
||||||
gl.GenTextures(1, &t)
|
gl.GenTextures(1, &t)
|
@ -15,7 +15,7 @@
|
|||||||
package graphics
|
package graphics
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
|
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
|
||||||
"math"
|
"math"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
package graphics
|
package graphics
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
|
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ package graphics
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphics/internal/opengl"
|
"github.com/hajimehoshi/ebiten/internal/graphics/opengl"
|
||||||
"image"
|
"image"
|
||||||
"image/draw"
|
"image/draw"
|
||||||
)
|
)
|
||||||
|
@ -64,10 +64,16 @@ func Init() {
|
|||||||
|
|
||||||
func ExecOnUIThread(f func()) {
|
func ExecOnUIThread(f func()) {
|
||||||
ch := make(chan struct{})
|
ch := make(chan struct{})
|
||||||
currentUI.funcs <- func() {
|
/*currentUI.funcs <- func() {
|
||||||
defer close(ch)
|
defer close(ch)
|
||||||
f()
|
f()
|
||||||
}
|
}*/
|
||||||
|
go func() {
|
||||||
|
defer close(ch)
|
||||||
|
runtime.LockOSThread()
|
||||||
|
currentUI.window.MakeContextCurrent()
|
||||||
|
f()
|
||||||
|
}()
|
||||||
<-ch
|
<-ch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
run.go
6
run.go
@ -15,7 +15,7 @@
|
|||||||
package ebiten
|
package ebiten
|
||||||
|
|
||||||
import (
|
import (
|
||||||
audio "github.com/hajimehoshi/ebiten/exp/audio/internal"
|
audio "github.com/hajimehoshi/ebiten/exp/audio/inner"
|
||||||
"github.com/hajimehoshi/ebiten/internal/ui"
|
"github.com/hajimehoshi/ebiten/internal/ui"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -54,6 +54,10 @@ func Run(f func(*Image) error, width, height, scale int, title string) error {
|
|||||||
}
|
}
|
||||||
defer ui.Terminate()
|
defer ui.Terminate()
|
||||||
|
|
||||||
|
ui.ExecOnUIThread(func() {
|
||||||
|
glContext.Check()
|
||||||
|
})
|
||||||
|
|
||||||
graphicsContext, err := newGraphicsContext(width, height, actualScale)
|
graphicsContext, err := newGraphicsContext(width, height, actualScale)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user