Refactoring

This commit is contained in:
Hajime Hoshi 2013-10-16 01:12:29 +09:00
parent 319d1bfc74
commit 75b1c850a1
3 changed files with 23 additions and 24 deletions

View File

@ -16,16 +16,15 @@ import (
) )
type UI struct { type UI struct {
screenWidth int screenWidth int
screenHeight int screenHeight int
screenScale int screenScale int
title string title string
initializing chan ebiten.Game initializing chan ebiten.Game
initialized chan ebiten.Game initialized chan ebiten.Game
updating chan ebiten.Game updating chan ebiten.Game
updated chan ebiten.Game updated chan ebiten.Game
input chan ebiten.InputState input chan ebiten.InputState
graphicsDevice *opengl.Device
} }
var currentUI *UI var currentUI *UI

View File

@ -53,15 +53,15 @@ func New(screenWidth, screenHeight, screenScale int, title string) *UI {
panic("UI can't be duplicated.") panic("UI can't be duplicated.")
} }
ui := &UI{ ui := &UI{
screenWidth: screenWidth, screenWidth: screenWidth,
screenHeight: screenHeight, screenHeight: screenHeight,
screenScale: screenScale, screenScale: screenScale,
title: title, title: title,
initializing: make(chan ebiten.Game), initializing: make(chan ebiten.Game),
initialized: make(chan ebiten.Game), initialized: make(chan ebiten.Game),
updating: make(chan ebiten.Game), updating: make(chan ebiten.Game),
updated: make(chan ebiten.Game), updated: make(chan ebiten.Game),
input: make(chan ebiten.InputState), input: make(chan ebiten.InputState),
glutInputting: make(chan glutInputEvent), glutInputting: make(chan glutInputEvent),
} }
currentUI = ui currentUI = ui

View File

@ -7,13 +7,13 @@ import (
type UI interface { type UI interface {
MainLoop() MainLoop()
ScreenWidth() int ScreenWidth() int
ScreenHeight() int ScreenHeight() int
Initializing() chan<- ebiten.Game Initializing() chan<- ebiten.Game
Initialized() <-chan ebiten.Game Initialized() <-chan ebiten.Game
Updating() chan<- ebiten.Game Updating() chan<- ebiten.Game
Updated() <-chan ebiten.Game Updated() <-chan ebiten.Game
Input() <-chan ebiten.InputState Input() <-chan ebiten.InputState
} }
func mainLoop(ui UI, game ebiten.Game) { func mainLoop(ui UI, game ebiten.Game) {