2013-12-02 16:15:01 +01:00
|
|
|
package ui
|
2013-06-18 17:48:41 +02:00
|
|
|
|
|
|
|
import (
|
2013-10-14 04:34:58 +02:00
|
|
|
"github.com/hajimehoshi/go-ebiten/graphics"
|
2013-06-18 17:48:41 +02:00
|
|
|
)
|
|
|
|
|
2013-12-15 17:13:18 +01:00
|
|
|
type Key int
|
|
|
|
|
|
|
|
const (
|
|
|
|
KeyUp Key = iota
|
|
|
|
KeyDown
|
|
|
|
KeyLeft
|
|
|
|
KeyRight
|
2013-12-18 10:05:28 +01:00
|
|
|
KeySpace
|
2013-12-18 19:21:25 +01:00
|
|
|
KeyMax
|
2013-12-15 17:13:18 +01:00
|
|
|
)
|
|
|
|
|
2013-12-18 10:05:28 +01:00
|
|
|
type WindowSizeUpdatedEvent struct {
|
2013-11-29 19:21:10 +01:00
|
|
|
Width int
|
|
|
|
Height int
|
|
|
|
}
|
|
|
|
|
2013-12-15 17:13:18 +01:00
|
|
|
type KeyStateUpdatedEvent struct {
|
|
|
|
Keys []Key
|
|
|
|
}
|
|
|
|
|
2013-12-15 15:41:33 +01:00
|
|
|
type MouseStateUpdatedEvent struct {
|
2013-07-04 16:57:53 +02:00
|
|
|
X int
|
|
|
|
Y int
|
2013-06-25 03:27:32 +02:00
|
|
|
}
|
2013-11-29 19:21:10 +01:00
|
|
|
|
2013-12-10 16:49:30 +01:00
|
|
|
type WindowClosedEvent struct {
|
|
|
|
}
|
|
|
|
|
2013-11-29 19:21:10 +01:00
|
|
|
type UI interface {
|
2014-01-11 10:11:13 +01:00
|
|
|
DoEvents()
|
2013-12-30 19:17:39 +01:00
|
|
|
CreateGameWindow(screenWidth, screenHeight, screenScale int, title string) GameWindow
|
2014-01-06 18:14:53 +01:00
|
|
|
RunMainLoop()
|
2013-11-29 19:21:10 +01:00
|
|
|
}
|
2013-12-09 14:40:54 +01:00
|
|
|
|
|
|
|
type Window interface {
|
2013-12-30 19:17:39 +01:00
|
|
|
Events() <-chan interface{}
|
|
|
|
}
|
|
|
|
|
|
|
|
type GameWindow interface {
|
2013-12-13 22:10:24 +01:00
|
|
|
Draw(func(graphics.Context))
|
2014-01-06 16:10:46 +01:00
|
|
|
Window
|
2013-12-09 14:40:54 +01:00
|
|
|
}
|