Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
103 lines (74 sloc) 1.09 KB
package strife
import (
"github.com/veandco/go-sdl2/sdl"
)
type StrifeEvent interface {
sdl.Event
Trigger()
}
func HandleEvent(event StrifeEvent) {
event.Trigger()
}
// BASIC EVENT
type BaseEvent struct{}
func (b *BaseEvent) GetTimestamp() uint32 {
// ?!
return 0
}
func (b *BaseEvent) GetType() uint32 {
return 0 // ?
}
func (b *BaseEvent) Trigger() {}
// MOUSE EVENTS
type MouseWheelEvent struct {
BaseEvent
X, Y int
}
type MouseMoveEvent struct {
BaseEvent
X, Y int
}
// KEYBOARD
type KeyUpEvent struct {
BaseEvent
KeyCode int
}
type KeyDownEvent struct {
BaseEvent
KeyCode int
}
// WINDOW CLOSE
type CloseEvent struct {
BaseEvent
}
// WINDOW VISIBILITY
type Visibility int
const (
Shown Visibility = iota
Hidden
Exposed
)
type WindowVisibilityEvent struct {
BaseEvent
Visibility
}
// WINDOW RESIZE
type WindowResizeEvent struct {
BaseEvent
Width, Height int
}
// WINDOW MOVE
type WindowMoveEvent struct {
BaseEvent
X, Y int
}
// WINDOW FOCUS
type Focus int
const (
FocusGained Focus = iota
FocusLost
)
type WindowFocusEvent struct {
BaseEvent
Focus
}