Remove ui package

This commit is contained in:
Hajime Hoshi 2013-06-19 09:36:57 +09:00
parent 45c59133ef
commit 2cadd50d01
2 changed files with 10 additions and 16 deletions

View File

@ -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)
}

View File

@ -1,12 +0,0 @@
package ui
import (
"github.com/hajimehoshi/go-ebiten/graphics"
)
type UI interface {
ScreenWidth() int
ScreenHeight() int
ScreenScale() int
Run(device graphics.Device)
}