mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Refactoring
This commit is contained in:
parent
319d1bfc74
commit
75b1c850a1
@ -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
|
||||||
|
@ -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
|
||||||
|
10
ui/ui.go
10
ui/ui.go
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user