mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
Remove ui package
This commit is contained in:
parent
45c59133ef
commit
2cadd50d01
14
ebiten.go
14
ebiten.go
@ -4,7 +4,6 @@ import (
|
||||
"time"
|
||||
"github.com/hajimehoshi/go-ebiten/graphics"
|
||||
"github.com/hajimehoshi/go-ebiten/graphics/opengl"
|
||||
"github.com/hajimehoshi/go-ebiten/ui"
|
||||
)
|
||||
|
||||
type Game interface {
|
||||
@ -12,10 +11,17 @@ type Game interface {
|
||||
Draw(g graphics.GraphicsContext, offscreen graphics.Texture)
|
||||
}
|
||||
|
||||
func OpenGLRun(game Game, u ui.UI) {
|
||||
type UI interface {
|
||||
ScreenWidth() int
|
||||
ScreenHeight() int
|
||||
ScreenScale() int
|
||||
Run(device graphics.Device)
|
||||
}
|
||||
|
||||
func OpenGLRun(game Game, ui UI) {
|
||||
ch := make(chan bool, 1)
|
||||
device := opengl.NewDevice(
|
||||
u.ScreenWidth(), u.ScreenHeight(), u.ScreenScale(),
|
||||
ui.ScreenWidth(), ui.ScreenHeight(), ui.ScreenScale(),
|
||||
func(g graphics.GraphicsContext, offscreen graphics.Texture) {
|
||||
ticket := <-ch
|
||||
game.Draw(g, offscreen)
|
||||
@ -34,5 +40,5 @@ func OpenGLRun(game Game, u ui.UI) {
|
||||
}()
|
||||
ch<- true
|
||||
|
||||
u.Run(device)
|
||||
ui.Run(device)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user