Documentation ¶
Overview ¶
Definitions for different kinds of events. Note that Events in this package are GAME events, not SDL events. The job of this package is to take input from SDL, and convert it into game events which can be passed on into the main game itself.
Index ¶
Constants ¶
const ( NONE = iota TERMINATE TOGGLE_DRAW SELECT TOGGLE_FRAME_LIMIT SPEED_UP SPEED_DOWN )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicEvent ¶
type BasicEvent struct {
EventType EventType
}
A basic event. Contains just an event code, and no additional data.
func (BasicEvent) GetType ¶
func (e BasicEvent) GetType() EventType
GetType returns the event type code for the given event.
type Event ¶
type Event interface {
GetType() EventType // Returns the event type.
}
Event interface. This is a little weird, but since there's no subclassing, we need an interface here to allow us to pass around different kinds of events blindly.
type Handler ¶
type Handler map[EventType][]listener
Handler farms events out to anyone who has registed interest.
var (
Global Handler = NewHandler()
)
func NewHandler ¶
func NewHandler() Handler
NewHandler returns a new Handler with no registered listeners.
type LocationEvent ¶
type LocationEvent struct { BasicEvent // contains filtered or unexported fields }
An event with an associated location.