Documentation ¶
Index ¶
- Constants
- Variables
- type Action
- type ActionHandler
- type ActionSet
- type ActionSets
- type ActionSetsInput
- type Actions
- type Data
- type Device
- type DeviceType
- type EmptySystem
- type Gesture
- type Input
- type InputSystem
- type KeyInfo
- type KeyTrigger
- type Point
- type System
- func (sys *System) AddPoint(point *Point)
- func (in *System) ConnectDevice(newDevice *Device)
- func (in *System) ConnectInput(newInput *Input)
- func (sys *System) Devices() []*Device
- func (in *System) DisconnectDevice(oldDevice *Device)
- func (in *System) DisconnectInput(oldInput *Input)
- func (sys *System) Events() *core.Listeners[SystemEvents]
- func (sys *System) Get(inputName string) *Input
- func (sys *System) InputTime() time.Time
- func (sys *System) Inputs() []*Input
- func (sys *System) Points() []*Point
- func (in *System) SetInputEnter(ia *Point)
- func (in *System) SetInputLeave(ia *Point)
- func (in *System) SetInputPoint(ia *Point, x, y float32)
- func (sys *System) SetInputTime(now time.Time)
- func (in *System) SetInputValue(ia *Input, newValue float32)
- type SystemEvents
- type Trigger
- type TriggerBuilder
- func (builder *TriggerBuilder) And(triggers ...Trigger) Trigger
- func (builder *TriggerBuilder) FirstInterval(firstInterval time.Duration, interval time.Duration, trigger Trigger) Trigger
- func (builder *TriggerBuilder) Interval(interval time.Duration, trigger Trigger) Trigger
- func (builder *TriggerBuilder) Key(key KeyTrigger) Trigger
- func (builder *TriggerBuilder) Named(name string) Trigger
- func (builder *TriggerBuilder) Off(name string) Trigger
- func (builder *TriggerBuilder) On(name string) Trigger
- func (builder *TriggerBuilder) Once(trigger Trigger) Trigger
- func (builder *TriggerBuilder) Or(triggers ...Trigger) Trigger
- func (builder *TriggerBuilder) Value(value float32, trigger Trigger) Trigger
- type TriggerGroup
- type TriggerGroupOp
- type TriggerInterval
- type TriggerNamed
- type TriggerNone
- type TriggerOnce
- type TriggerRange
- type TriggerValue
- type Vector
Constants ¶
View Source
const ( KeySpace string = "space" KeyApostrophe string = "apostrophe" KeyComma string = "comma" KeyMinus string = "minus" KeyPeriod string = "period" KeySlash string = "slash" Key0 string = "0" Key1 string = "1" Key2 string = "2" Key3 string = "3" Key4 string = "4" Key5 string = "5" Key6 string = "6" Key7 string = "7" Key8 string = "8" Key9 string = "9" KeySemicolon string = "semicolon" KeyEqual string = "equal" KeyA string = "a" KeyB string = "b" KeyC string = "c" KeyD string = "d" KeyE string = "e" KeyF string = "f" KeyG string = "g" KeyH string = "h" KeyI string = "i" KeyJ string = "j" KeyK string = "k" KeyL string = "l" KeyM string = "m" KeyN string = "n" KeyO string = "o" KeyP string = "p" KeyQ string = "q" KeyR string = "r" KeyS string = "s" KeyT string = "t" KeyU string = "u" KeyV string = "v" KeyW string = "w" KeyX string = "x" KeyY string = "y" KeyZ string = "z" KeyLeftBracket string = "[" KeyBackslash string = "/" KeyRightBracket string = "]" KeyGraveAccent string = "`" KeyWorld1 string = "world1" KeyWorld2 string = "world2" KeyEscape string = "escape" KeyEnter string = "enter" KeyTab string = "tab" KeyBackspace string = "backspace" KeyInsert string = "insert" KeyDelete string = "delete" KeyRight string = "right" KeyLeft string = "left" KeyDown string = "down" KeyUp string = "up" KeyPageUp string = "page up" KeyPageDown string = "page down" KeyHome string = "home" KeyEnd string = "end" KeyCapsLock string = "caps lock" KeyScrollLock string = "scroll lock" KeyNumLock string = "num lock" KeyPrintScreen string = "print" KeyPause string = "pause" KeyF1 string = "f1" KeyF2 string = "f2" KeyF3 string = "f3" KeyF4 string = "f4" KeyF5 string = "f5" KeyF6 string = "f6" KeyF7 string = "f7" KeyF8 string = "f8" KeyF9 string = "f9" KeyF10 string = "f10" KeyF11 string = "f11" KeyF12 string = "f12" KeyF13 string = "f13" KeyF14 string = "f14" KeyF15 string = "f15" KeyF16 string = "f16" KeyF17 string = "f17" KeyF18 string = "f18" KeyF19 string = "f19" KeyF20 string = "f20" KeyF21 string = "f21" KeyF22 string = "f22" KeyF23 string = "f23" KeyF24 string = "f24" KeyF25 string = "f25" KeyKP0 string = "numpad 0" KeyKP1 string = "numpad 1" KeyKP2 string = "numpad 2" KeyKP3 string = "numpad 3" KeyKP4 string = "numpad 4" KeyKP5 string = "numpad 5" KeyKP6 string = "numpad 6" KeyKP7 string = "numpad 7" KeyKP8 string = "numpad 8" KeyKP9 string = "numpad 9" KeyKPDecimal string = "numpad decimal" KeyKPDivide string = "numpad divide" KeyKPMultiply string = "numpad multiply" KeyKPSubtract string = "numpad subtract" KeyKPAdd string = "numpad add" KeyKPEnter string = "numpad enter" KeyKPEqual string = "numpad equal" KeyLeftShift string = "left shift" KeyLeftControl string = "left ctrl" KeyLeftAlt string = "left alt" KeyLeftSuper string = "left super" KeyRightShift string = "right shift" KeyRightControl string = "right control" KeyRightAlt string = "right alt" KeyRightSuper string = "right super" KeyMenu string = "menu" )
Variables ¶
View Source
var KeyInfos = map[string]KeyInfo{ KeySpace: {Upper: ' ', Lower: ' '}, KeyApostrophe: {Upper: '"', Lower: '\''}, KeyComma: {Upper: '<', Lower: ','}, KeyMinus: {Upper: '_', Lower: '-'}, KeyPeriod: {Upper: '>', Lower: '.'}, KeySlash: {Upper: '?', Lower: '/'}, Key0: {Upper: ')', Lower: '0'}, Key1: {Upper: '!', Lower: '1'}, Key2: {Upper: '@', Lower: '2'}, Key3: {Upper: '#', Lower: '3'}, Key4: {Upper: '$', Lower: '4'}, Key5: {Upper: '%', Lower: '5'}, Key6: {Upper: '^', Lower: '6'}, Key7: {Upper: '&', Lower: '7'}, Key8: {Upper: '*', Lower: '8'}, Key9: {Upper: '(', Lower: '9'}, KeySemicolon: {Upper: ':', Lower: ';'}, KeyEqual: {Upper: '+', Lower: '='}, KeyA: {Upper: 'A', Lower: 'a'}, KeyB: {Upper: 'B', Lower: 'b'}, KeyC: {Upper: 'C', Lower: 'c'}, KeyD: {Upper: 'D', Lower: 'd'}, KeyE: {Upper: 'E', Lower: 'e'}, KeyF: {Upper: 'F', Lower: 'f'}, KeyG: {Upper: 'G', Lower: 'g'}, KeyH: {Upper: 'H', Lower: 'h'}, KeyI: {Upper: 'I', Lower: 'i'}, KeyJ: {Upper: 'J', Lower: 'j'}, KeyK: {Upper: 'K', Lower: 'k'}, KeyL: {Upper: 'L', Lower: 'l'}, KeyM: {Upper: 'M', Lower: 'm'}, KeyN: {Upper: 'N', Lower: 'n'}, KeyO: {Upper: 'O', Lower: 'o'}, KeyP: {Upper: 'P', Lower: 'p'}, KeyQ: {Upper: 'Q', Lower: 'q'}, KeyR: {Upper: 'R', Lower: 'r'}, KeyS: {Upper: 'S', Lower: 's'}, KeyT: {Upper: 'T', Lower: 't'}, KeyU: {Upper: 'U', Lower: 'u'}, KeyV: {Upper: 'V', Lower: 'v'}, KeyW: {Upper: 'W', Lower: 'w'}, KeyX: {Upper: 'X', Lower: 'x'}, KeyY: {Upper: 'Y', Lower: 'y'}, KeyZ: {Upper: 'Z', Lower: 'z'}, KeyLeftBracket: {Upper: '{', Lower: '['}, KeyBackslash: {Upper: '|', Lower: '\\'}, KeyRightBracket: {Upper: '}', Lower: ']'}, KeyGraveAccent: {Upper: '~', Lower: '`'}, KeyEnter: {Upper: '\n', Lower: '\n'}, KeyTab: {Upper: '\t', Lower: '\t'}, KeyBackspace: {Upper: '\b', Lower: '\b'}, KeyKP0: {Upper: '0', Lower: '0'}, KeyKP1: {Upper: '1', Lower: '1'}, KeyKP2: {Upper: '2', Lower: '2'}, KeyKP3: {Upper: '3', Lower: '3'}, KeyKP4: {Upper: '4', Lower: '4'}, KeyKP5: {Upper: '5', Lower: '5'}, KeyKP6: {Upper: '6', Lower: '6'}, KeyKP7: {Upper: '7', Lower: '7'}, KeyKP8: {Upper: '8', Lower: '8'}, KeyKP9: {Upper: '9', Lower: '9'}, KeyKPDecimal: {Upper: '.', Lower: '.'}, KeyKPDivide: {Upper: '/', Lower: '/'}, KeyKPMultiply: {Upper: '*', Lower: '*'}, KeyKPSubtract: {Upper: '-', Lower: '-'}, KeyKPAdd: {Upper: '+', Lower: '+'}, KeyKPEnter: {Upper: '\n', Lower: '\n'}, KeyKPEqual: {Upper: '=', Lower: '='}, }
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { Name string Enabled react.Value[bool] Trigger Trigger Data Data Triggered bool OverridePriority int }
func (*Action) Init ¶
func (action *Action) Init(inputs InputSystem)
func (*Action) Update ¶
func (action *Action) Update(inputs InputSystem)
type ActionHandler ¶
type ActionHandler func(action *Action)
type ActionSet ¶
type ActionSet struct { Name string Enabled react.Value[bool] Actions Actions Triggered ds.CircularQueue[*Action] }
func NewActionSet ¶
func (*ActionSet) Init ¶
func (set *ActionSet) Init(inputs InputSystem)
func (*ActionSet) Update ¶
func (set *ActionSet) Update(inputs InputSystem)
type ActionSets ¶
type ActionSets struct { Sets map[string]*ActionSet Handler ActionHandler }
func CreateActionSets ¶
func CreateActionSets(actionSets ActionSetsInput) ActionSets
func NewActionSets ¶
func NewActionSets() ActionSets
func (*ActionSets) Add ¶
func (sets *ActionSets) Add(set *ActionSet)
func (*ActionSets) Init ¶
func (sets *ActionSets) Init(inputs InputSystem)
func (*ActionSets) Update ¶
func (sets *ActionSets) Update(inputs InputSystem)
type ActionSetsInput ¶
type DeviceType ¶
type DeviceType string
const ( DeviceTypeKeyboard DeviceType = "keyboard" DeviceTypeMouse DeviceType = "mouse" DeviceTypeController DeviceType = "controller" DeviceTypeTouch DeviceType = "touch" )
type EmptySystem ¶
type EmptySystem struct{}
func (*EmptySystem) Devices ¶
func (in *EmptySystem) Devices() []*Device
func (*EmptySystem) Events ¶
func (in *EmptySystem) Events() *core.Listeners[SystemEvents]
func (*EmptySystem) Get ¶
func (in *EmptySystem) Get(name string) *Input
func (*EmptySystem) InputTime ¶
func (in *EmptySystem) InputTime() time.Time
func (*EmptySystem) Inputs ¶
func (in *EmptySystem) Inputs() []*Input
func (*EmptySystem) Points ¶
func (in *EmptySystem) Points() []*Point
type Input ¶
type Input struct { Name string Value float32 ValueChanged time.Time ValueDuration time.Duration PreviousValue float32 PreviousChanged time.Time PreviousDuration time.Duration Device *Device Action *Action }
func (*Input) UpdateDuration ¶
type InputSystem ¶
type KeyTrigger ¶
type System ¶
type System struct {
// contains filtered or unexported fields
}
func (*System) ConnectDevice ¶
func (*System) ConnectInput ¶
func (*System) DisconnectDevice ¶
func (*System) DisconnectInput ¶
func (*System) SetInputEnter ¶
func (*System) SetInputLeave ¶
func (*System) SetInputPoint ¶
func (*System) SetInputTime ¶
func (*System) SetInputValue ¶
type SystemEvents ¶
type SystemEvents struct { DeviceConnected func(newDevice Device) DeviceDisconnected func(oldDevice Device) InputConnected func(newInput Input) InputDisconnected func(oldInput Input) InputChange func(input Input) PointConnected func(newPoint Point) PointDisconnected func(oldPoint Point) PointChange func(point Point) PointLeave func(point Point) PointEnter func(point Point) InputChangeMap map[string]func(input Input) }
type Trigger ¶
type Trigger interface { Init(inputs InputSystem) Update(inputs InputSystem) (Data, bool) InputCount() int }
func NewKeyTrigger ¶
func NewKeyTrigger(trigger KeyTrigger) Trigger
type TriggerBuilder ¶
type TriggerBuilder struct{}
func (*TriggerBuilder) And ¶
func (builder *TriggerBuilder) And(triggers ...Trigger) Trigger
func (*TriggerBuilder) FirstInterval ¶
func (*TriggerBuilder) Interval ¶
func (builder *TriggerBuilder) Interval(interval time.Duration, trigger Trigger) Trigger
func (*TriggerBuilder) Key ¶
func (builder *TriggerBuilder) Key(key KeyTrigger) Trigger
func (*TriggerBuilder) Named ¶
func (builder *TriggerBuilder) Named(name string) Trigger
func (*TriggerBuilder) Off ¶
func (builder *TriggerBuilder) Off(name string) Trigger
func (*TriggerBuilder) On ¶
func (builder *TriggerBuilder) On(name string) Trigger
func (*TriggerBuilder) Once ¶
func (builder *TriggerBuilder) Once(trigger Trigger) Trigger
func (*TriggerBuilder) Or ¶
func (builder *TriggerBuilder) Or(triggers ...Trigger) Trigger
type TriggerGroup ¶
type TriggerGroup struct { Op TriggerGroupOp All bool Triggers []Trigger }
func (*TriggerGroup) Init ¶
func (i *TriggerGroup) Init(inputs InputSystem)
func (*TriggerGroup) InputCount ¶
func (i *TriggerGroup) InputCount() int
func (*TriggerGroup) Update ¶
func (i *TriggerGroup) Update(inputs InputSystem) (Data, bool)
type TriggerGroupOp ¶
type TriggerGroupOp string
const ( TriggerGroupOpMin TriggerGroupOp = "min" TriggerGroupOpMax TriggerGroupOp = "max" TriggerGroupOpAverage TriggerGroupOp = "mavg" )
type TriggerInterval ¶
type TriggerInterval struct { Trigger Trigger FirstInterval time.Duration Interval time.Duration Strict bool // contains filtered or unexported fields }
func (*TriggerInterval) Init ¶
func (i *TriggerInterval) Init(inputs InputSystem)
func (*TriggerInterval) InputCount ¶
func (i *TriggerInterval) InputCount() int
func (*TriggerInterval) Update ¶
func (i *TriggerInterval) Update(inputs InputSystem) (Data, bool)
type TriggerNamed ¶
type TriggerNamed struct { Name string // contains filtered or unexported fields }
func (*TriggerNamed) Init ¶
func (i *TriggerNamed) Init(inputs InputSystem)
func (*TriggerNamed) InputCount ¶
func (i *TriggerNamed) InputCount() int
func (*TriggerNamed) Update ¶
func (i *TriggerNamed) Update(inputs InputSystem) (Data, bool)
type TriggerNone ¶
type TriggerNone struct{}
func (*TriggerNone) Init ¶
func (i *TriggerNone) Init(inputs InputSystem)
func (*TriggerNone) InputCount ¶
func (i *TriggerNone) InputCount() int
func (*TriggerNone) Update ¶
func (i *TriggerNone) Update(inputs InputSystem) (Data, bool)
type TriggerOnce ¶
type TriggerOnce struct { Trigger Trigger // contains filtered or unexported fields }
func (*TriggerOnce) Init ¶
func (i *TriggerOnce) Init(inputs InputSystem)
func (*TriggerOnce) InputCount ¶
func (i *TriggerOnce) InputCount() int
func (*TriggerOnce) Update ¶
func (i *TriggerOnce) Update(inputs InputSystem) (Data, bool)
type TriggerRange ¶
type TriggerRange struct { TriggerMin float32 TriggerMinInclude bool TriggerMax float32 TriggerMaxInclude bool Trigger Trigger }
func (*TriggerRange) Init ¶
func (i *TriggerRange) Init(inputs InputSystem)
func (*TriggerRange) InputCount ¶
func (i *TriggerRange) InputCount() int
func (*TriggerRange) Update ¶
func (i *TriggerRange) Update(inputs InputSystem) (Data, bool)
type TriggerValue ¶
func (*TriggerValue) Init ¶
func (i *TriggerValue) Init(inputs InputSystem)
func (*TriggerValue) InputCount ¶
func (i *TriggerValue) InputCount() int
func (*TriggerValue) Update ¶
func (i *TriggerValue) Update(inputs InputSystem) (Data, bool)
Click to show internal directories.
Click to hide internal directories.