Documentation
¶
Index ¶
- Constants
- Variables
- type Event
- type EventManager
- type EventName
- type Key
- type Keyboard
- type Mouse
- func (mouse *Mouse) AddMouseButtonCallback(callback glfw.MouseButtonCallback)
- func (mouse *Mouse) AddMousePosCallback(callback glfw.CursorPosCallback)
- func (mouse *Mouse) AddMouseScrollCallback(callback glfw.ScrollCallback)
- func (mouse *Mouse) IsButtonPressed(key Key) bool
- func (mouse *Mouse) RegisterCallbacks(win *Window)
- func (mouse *Mouse) X() float64
- func (mouse *Mouse) Y() float64
- type Window
Constants ¶
const ( KeyUnknown = Key(glfw.KeyUnknown) KeyEscape = Key(glfw.KeyEscape) KeyF1 = Key(glfw.KeyF1) KeyF2 = Key(glfw.KeyF2) KeyF3 = Key(glfw.KeyF3) KeyF4 = Key(glfw.KeyF4) KeyF5 = Key(glfw.KeyF5) KeyF6 = Key(glfw.KeyF6) KeyF7 = Key(glfw.KeyF7) KeyF8 = Key(glfw.KeyF8) KeyF9 = Key(glfw.KeyF9) KeyF10 = Key(glfw.KeyF10) KeyF11 = Key(glfw.KeyF11) KeyF12 = Key(glfw.KeyF12) KeyF13 = Key(glfw.KeyF13) KeyF14 = Key(glfw.KeyF14) KeyF15 = Key(glfw.KeyF15) KeyF16 = Key(glfw.KeyF16) KeyF17 = Key(glfw.KeyF17) KeyF18 = Key(glfw.KeyF18) KeyF19 = Key(glfw.KeyF19) KeyF20 = Key(glfw.KeyF20) KeyF21 = Key(glfw.KeyF21) KeyF22 = Key(glfw.KeyF22) KeyF23 = Key(glfw.KeyF23) KeyF24 = Key(glfw.KeyF24) KeyF25 = Key(glfw.KeyF25) KeyKP0 = Key(glfw.KeyKP0) KeyKP1 = Key(glfw.KeyKP1) KeyKP2 = Key(glfw.KeyKP2) KeyKP3 = Key(glfw.KeyKP3) KeyKP4 = Key(glfw.KeyKP4) KeyKP5 = Key(glfw.KeyKP5) KeyKP6 = Key(glfw.KeyKP6) KeyKP7 = Key(glfw.KeyKP7) KeyKP8 = Key(glfw.KeyKP8) KeyKP9 = Key(glfw.KeyKP9) KeyKPDecimal = Key(glfw.KeyKPDecimal) KeyKPDivide = Key(glfw.KeyKPDivide) KeyKPMultiply = Key(glfw.KeyKPMultiply) KeyKPSubtract = Key(glfw.KeyKPSubtract) KeyKPAdd = Key(glfw.KeyKPAdd) KeyKPEnter = Key(glfw.KeyKPEnter) KeyKPEqual = Key(glfw.KeyKPEqual) Key1 = Key(glfw.Key1) Key2 = Key(glfw.Key2) Key3 = Key(glfw.Key3) Key4 = Key(glfw.Key4) Key5 = Key(glfw.Key5) Key6 = Key(glfw.Key6) Key7 = Key(glfw.Key7) Key8 = Key(glfw.Key8) Key9 = Key(glfw.Key9) Key0 = Key(glfw.Key0) KeySemicolon = Key(glfw.KeySemicolon) KeyMinus = Key(glfw.KeyMinus) KeyEqual = Key(glfw.KeyEqual) KeyBackspace = Key(glfw.KeyBackspace) KeyTab = Key(glfw.KeyTab) KeyQ = Key(glfw.KeyQ) KeyW = Key(glfw.KeyW) KeyE = Key(glfw.KeyE) KeyR = Key(glfw.KeyR) KeyT = Key(glfw.KeyT) KeyY = Key(glfw.KeyY) KeyU = Key(glfw.KeyU) KeyI = Key(glfw.KeyI) KeyO = Key(glfw.KeyO) KeyP = Key(glfw.KeyP) KeyLeftBracket = Key(glfw.KeyLeftBracket) KeyRightBracket = Key(glfw.KeyRightBracket) KeyGraveAccent = Key(glfw.KeyGraveAccent) KeyWorld1 = Key(glfw.KeyWorld1) KeyWorld2 = Key(glfw.KeyWorld2) KeyBackslash = Key(glfw.KeyBackslash) KeyCapsLock = Key(glfw.KeyCapsLock) KeyA = Key(glfw.KeyA) KeyS = Key(glfw.KeyS) KeyD = Key(glfw.KeyD) KeyF = Key(glfw.KeyF) KeyG = Key(glfw.KeyG) KeyH = Key(glfw.KeyH) KeyJ = Key(glfw.KeyJ) KeyK = Key(glfw.KeyK) KeyL = Key(glfw.KeyL) KeySemiColon = Key(glfw.KeySemicolon) KeyApostrophe = Key(glfw.KeyApostrophe) KeyEnter = Key(glfw.KeyEnter) KeyLeftShift = Key(glfw.KeyLeftShift) KeyZ = Key(glfw.KeyZ) KeyX = Key(glfw.KeyX) KeyC = Key(glfw.KeyC) KeyV = Key(glfw.KeyV) KeyB = Key(glfw.KeyB) KeyN = Key(glfw.KeyN) KeyM = Key(glfw.KeyM) KeyComma = Key(glfw.KeyComma) KeyPeriod = Key(glfw.KeyPeriod) KeySlash = Key(glfw.KeySlash) KeyRightShift = Key(glfw.KeyRightShift) KeyLeftCtrl = Key(glfw.KeyLeftControl) KeyLeftAlt = Key(glfw.KeyLeftAlt) KeySpace = Key(glfw.KeySpace) KeyRightAlt = Key(glfw.KeyRightAlt) KeyRightCtrl = Key(glfw.KeyRightControl) KeyDelete = Key(glfw.KeyDelete) KeyInsert = Key(glfw.KeyInsert) KeyUp = Key(glfw.KeyUp) KeyLeft = Key(glfw.KeyLeft) KeyDown = Key(glfw.KeyDown) KeyRight = Key(glfw.KeyRight) KeyPageUp = Key(glfw.KeyPageUp) KeyPageDown = Key(glfw.KeyPageDown) KeyHome = Key(glfw.KeyHome) KeyEnd = Key(glfw.KeyEnd) KeyScrollLock = Key(glfw.KeyScrollLock) KeyNumLock = Key(glfw.KeyNumLock) KeyPrintScreen = Key(glfw.KeyPrintScreen) KeyPause = Key(glfw.KeyPause) KeyLeftSuper = Key(glfw.KeyLeftSuper) KeyRightSuper = Key(glfw.KeyRightSuper) KeyMenu = Key(glfw.KeyMenu) KeyLast = Key(glfw.KeyLast) )
const ( MouseButton1 = Key(glfw.MouseButton1) MouseButton2 = Key(glfw.MouseButton2) MouseButton3 = Key(glfw.MouseButton3) MouseButton4 = Key(glfw.MouseButton4) MouseButton5 = Key(glfw.MouseButton5) MouseButton6 = Key(glfw.MouseButton6) MouseButton7 = Key(glfw.MouseButton7) MouseButton8 = Key(glfw.MouseButton8) MouseButtonLast = Key(glfw.MouseButtonLast) MouseButtonLeft = Key(glfw.MouseButtonLeft) MouseButtonRight = Key(glfw.MouseButtonRight) MouseButtonMiddle = Key(glfw.MouseButtonMiddle) )
Variables ¶
var ( // ErrorAlreadyUnsubscribed ErrorAlreadyUnsubscribed = errors.New("already unsubscribed, or never subscribed") )
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event interface {
// Type returns the event identifier
Type() EventName
// Message returns the payload of the event. Its up the the receiver to know
// the intended format
Message() interface{}
}
Event
type EventManager ¶
type EventManager struct {
// contains filtered or unexported fields
}
EventManager provides a lightweight pub/sub utility for passing events around.
func NewEventManager ¶
func NewEventManager() *EventManager
NewEventManager returns a new EventManager
func (*EventManager) Publish ¶
func (service *EventManager) Publish(event Event) error
Publish takes an Event and executes all callbacks associated with the passed event.Type()
func (*EventManager) Subscribe ¶
func (service *EventManager) Subscribe(eventName EventName, callback func(event Event), owner interface{}) error
Subscribe takes a callback function and bind it with an EventName. When an event of that EventName is published, the callback will be executed.
func (*EventManager) Unsubscribe ¶
func (service *EventManager) Unsubscribe(eventName EventName, owner interface{}) error
Unsubscribe unassociated a particular callback from an EventName
type Keyboard ¶
type Keyboard struct {
// contains filtered or unexported fields
}
Keyboard provides the current state of the keyboard
func (*Keyboard) AddCharInputCallback ¶
func (keyboard *Keyboard) AddCharInputCallback(callback glfw.CharCallback)
AddCharInputCallback add a custom callback for the true character press. See glfw docs to distinguish between this and KeyCallback
func (*Keyboard) AddKeyCallback ¶
func (keyboard *Keyboard) AddKeyCallback(callback glfw.KeyCallback)
AddKeyCallback add a custom callback to when a key is pressed
func (*Keyboard) RegisterCallbacks ¶
RegisterCallbacks will set the passed windows event callbacks to this instance
type Mouse ¶
type Mouse struct {
// contains filtered or unexported fields
}
Mouse is a small wrapper for handling mouse information flow between an application and glfw
func (*Mouse) AddMouseButtonCallback ¶
func (mouse *Mouse) AddMouseButtonCallback(callback glfw.MouseButtonCallback)
AddMouseButtonCallback
func (*Mouse) AddMousePosCallback ¶
func (mouse *Mouse) AddMousePosCallback(callback glfw.CursorPosCallback)
AddMousePosCallback
func (*Mouse) AddMouseScrollCallback ¶
func (mouse *Mouse) AddMouseScrollCallback(callback glfw.ScrollCallback)
AddMouseScrollCallback
func (*Mouse) IsButtonPressed ¶
IsButtonPressed returns if a particular mouse button has been pressed.
func (*Mouse) RegisterCallbacks ¶
RegisterCallbacks will set the passed windows event callbacks to this instance