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-11-29 19:21:10 +01:00
|
|
|
type UI interface {
|
2014-05-11 14:24:37 +02:00
|
|
|
CreateCanvas(widht, height, scale int, title string) Canvas
|
2014-01-13 07:26:20 +01:00
|
|
|
Start()
|
|
|
|
DoEvents()
|
|
|
|
Terminate()
|
2013-11-29 19:21:10 +01:00
|
|
|
}
|
2013-12-09 14:40:54 +01:00
|
|
|
|
2014-05-11 19:16:23 +02:00
|
|
|
type Keys interface {
|
|
|
|
Includes(key Key) bool
|
|
|
|
}
|
|
|
|
|
2014-05-12 03:04:28 +02:00
|
|
|
type InputState interface {
|
|
|
|
PressedKeys() Keys
|
|
|
|
MouseX() int
|
|
|
|
MouseY() int
|
2013-12-30 19:17:39 +01:00
|
|
|
}
|
|
|
|
|
2014-05-11 14:24:37 +02:00
|
|
|
type Canvas interface {
|
2013-12-13 22:10:24 +01:00
|
|
|
Draw(func(graphics.Context))
|
2014-05-12 03:04:28 +02:00
|
|
|
IsClosed() bool
|
|
|
|
InputState() InputState
|
2013-12-09 14:40:54 +01:00
|
|
|
}
|