Refactoring

This commit is contained in:
Hajime Hoshi 2013-10-16 21:17:40 +09:00
parent 75b1c850a1
commit 2794c70388
2 changed files with 13 additions and 11 deletions

View File

@ -25,6 +25,7 @@ type UI struct {
updating chan ebiten.Game
updated chan ebiten.Game
input chan ebiten.InputState
graphicsDevice *opengl.Device
}
var currentUI *UI

View File

@ -17,6 +17,9 @@ type UI interface {
}
func mainLoop(ui UI, game ebiten.Game) {
ui.Initializing() <- game
game = <-ui.Initialized()
frameTime := time.Duration(int64(time.Second) / int64(ebiten.FPS))
tick := time.Tick(frameTime)
gameContext := &GameContext{
@ -24,8 +27,6 @@ func mainLoop(ui UI, game ebiten.Game) {
screenHeight: ui.ScreenHeight(),
inputState: ebiten.InputState{-1, -1},
}
ui.Initializing() <- game
game = <-ui.Initialized()
for {
select {
case gameContext.inputState = <-ui.Input():