Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Game ¶
func (*Game) CurrentStateID ¶
func (*Game) ReceiveKeyEvent ¶
func (*Game) ReceiveMouseEvent ¶
func (game *Game) ReceiveMouseEvent(event MouseEvent)
func (*Game) Transition ¶
type KeyEventTarget ¶
type KeyEventTarget interface {
HandleKeyEvent(event KeyEvent) *Transition
}
KeyEventTarget can be implemented by States to receive key events.
type KeyEventType ¶
type KeyEventType string
const ( KeyUp KeyEventType = "up" KeyDown KeyEventType = "down" KeyPress KeyEventType = "press" )
type MouseEvent ¶
type MouseEvent struct { Type MouseEventType Alt bool Ctrl bool Shift bool X int Y int // Button is the button pressed for mouse up and down events. Do not use this // directly, instead use PrimaryButton(), ... Button int }
func (MouseEvent) AuxiliaryButton ¶
func (event MouseEvent) AuxiliaryButton() bool
AuxiliaryButton checks wether the auxiliary button (usually middle / mouse wheel) was the cause of an up or down event.
func (MouseEvent) PrimaryButton ¶
func (event MouseEvent) PrimaryButton() bool
PrimaryButton checks wether the primary button (usually left) was the cause of an up or down event.
func (MouseEvent) SecondaryButton ¶
func (event MouseEvent) SecondaryButton() bool
SecondaryButton checks wether the secondary button (usually right) was the cause of an up or down event.
type MouseEventTarget ¶
type MouseEventTarget interface {
HandleMouseEvent(event MouseEvent) *Transition
}
MouseEventTarget can be implemented by States to receive mouse events.
type MouseEventType ¶
type MouseEventType string
const ( MouseUp MouseEventType = "up" MouseDown MouseEventType = "down" MouseMove MouseEventType = "move" )
type Object ¶
type Object struct { Key string X float64 Y float64 Z int // Animation is the progress of animation. 0 is the start, 1 is the end. Still // works if above or below this interval. Animation float64 // SmoothPosition is a flag to let objects break out from the fixed pixel grid. SmoothPosition bool Scale int }
type State ¶
type State interface { // Init will be called every time this state is transitioned to. Init() // Tick invokes a game tick, given a duration in milliseconds. Tick(ms int) *Transition Objects() map[string][]Object }
type Transition ¶
type Transition struct {
NextStateKey string
}
func NewTransition ¶
func NewTransition(nextStateKey string) *Transition
Click to show internal directories.
Click to hide internal directories.