mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-09-21 22:02:23 +02:00
43 lines
552 B
Go
43 lines
552 B
Go
package ui
|
|
|
|
import (
|
|
"github.com/hajimehoshi/go-ebiten/graphics"
|
|
)
|
|
|
|
type Key int
|
|
|
|
const (
|
|
KeyUp Key = iota
|
|
KeyDown
|
|
KeyLeft
|
|
KeyRight
|
|
KeySpace
|
|
KeyMax
|
|
)
|
|
|
|
type UI interface {
|
|
CreateCanvas(widht, height, scale int, title string) Canvas
|
|
Start()
|
|
DoEvents()
|
|
Terminate()
|
|
}
|
|
|
|
type Keys interface {
|
|
Includes(key Key) bool
|
|
}
|
|
|
|
type CanvasState struct {
|
|
Width int
|
|
Height int
|
|
Scale int
|
|
PressedKeys Keys
|
|
MouseX int
|
|
MouseY int
|
|
IsClosed bool
|
|
}
|
|
|
|
type Canvas interface {
|
|
Draw(func(graphics.Context))
|
|
State() CanvasState
|
|
}
|