mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 12:08:58 +01:00
Refactoring
This commit is contained in:
parent
319d1bfc74
commit
75b1c850a1
@ -16,16 +16,15 @@ import (
|
||||
)
|
||||
|
||||
type UI struct {
|
||||
screenWidth int
|
||||
screenHeight int
|
||||
screenScale int
|
||||
title string
|
||||
initializing chan ebiten.Game
|
||||
initialized chan ebiten.Game
|
||||
updating chan ebiten.Game
|
||||
updated chan ebiten.Game
|
||||
input chan ebiten.InputState
|
||||
graphicsDevice *opengl.Device
|
||||
screenWidth int
|
||||
screenHeight int
|
||||
screenScale int
|
||||
title string
|
||||
initializing chan ebiten.Game
|
||||
initialized chan ebiten.Game
|
||||
updating chan ebiten.Game
|
||||
updated chan ebiten.Game
|
||||
input chan ebiten.InputState
|
||||
}
|
||||
|
||||
var currentUI *UI
|
||||
|
@ -53,15 +53,15 @@ func New(screenWidth, screenHeight, screenScale int, title string) *UI {
|
||||
panic("UI can't be duplicated.")
|
||||
}
|
||||
ui := &UI{
|
||||
screenWidth: screenWidth,
|
||||
screenHeight: screenHeight,
|
||||
screenScale: screenScale,
|
||||
title: title,
|
||||
initializing: make(chan ebiten.Game),
|
||||
initialized: make(chan ebiten.Game),
|
||||
updating: make(chan ebiten.Game),
|
||||
updated: make(chan ebiten.Game),
|
||||
input: make(chan ebiten.InputState),
|
||||
screenWidth: screenWidth,
|
||||
screenHeight: screenHeight,
|
||||
screenScale: screenScale,
|
||||
title: title,
|
||||
initializing: make(chan ebiten.Game),
|
||||
initialized: make(chan ebiten.Game),
|
||||
updating: make(chan ebiten.Game),
|
||||
updated: make(chan ebiten.Game),
|
||||
input: make(chan ebiten.InputState),
|
||||
glutInputting: make(chan glutInputEvent),
|
||||
}
|
||||
currentUI = ui
|
||||
|
10
ui/ui.go
10
ui/ui.go
@ -7,13 +7,13 @@ import (
|
||||
|
||||
type UI interface {
|
||||
MainLoop()
|
||||
ScreenWidth() int
|
||||
ScreenWidth() int
|
||||
ScreenHeight() int
|
||||
Initializing() chan<- ebiten.Game
|
||||
Initialized() <-chan ebiten.Game
|
||||
Updating() chan<- ebiten.Game
|
||||
Updated() <-chan ebiten.Game
|
||||
Input() <-chan ebiten.InputState
|
||||
Initialized() <-chan ebiten.Game
|
||||
Updating() chan<- ebiten.Game
|
||||
Updated() <-chan ebiten.Game
|
||||
Input() <-chan ebiten.InputState
|
||||
}
|
||||
|
||||
func mainLoop(ui UI, game ebiten.Game) {
|
||||
|
Loading…
Reference in New Issue
Block a user