Documentation ¶
Index ¶
- Constants
- func AnyKeyChanged() bool
- func Button(name string) button
- func Mouse(key int) (btn *button, pos, delta f32.Vec2)
- func NewButton() (btn *button)
- func PointerButton(pb KeyPoint) button
- func RegisterButton(name string, keys ...Key)
- func Touch(fi FingerId) (btn button, pos, delta f32.Vec2)
- type FingerId
- type InputSystem
- func (in *InputSystem) AdvanceFrame()
- func (in *InputSystem) AnyKeyChanged() bool
- func (in *InputSystem) Button(name string) *button
- func (in *InputSystem) RegisterButton(name string, keys ...Key)
- func (in *InputSystem) Reset()
- func (in *InputSystem) SetKeyEvent(key int, pressed bool)
- func (in *InputSystem) SetPointerEvent(key int, pressed bool, x, y float32)
- type Key
- type KeyBind
- type KeyPoint
- type PointerInput
- type SparseMap
- type VAxis
Constants ¶
View Source
const ( Grave = Key(glfw.KeyGraveAccent) Dash = Key(glfw.KeyMinus) Apostrophe = Key(glfw.KeyApostrophe) Semicolon = Key(glfw.KeySemicolon) Equals = Key(glfw.KeyEqual) Comma = Key(glfw.KeyComma) Period = Key(glfw.KeyPeriod) Slash = Key(glfw.KeySlash) Backslash = Key(glfw.KeyBackslash) Backspace = Key(glfw.KeyBackspace) Tab = Key(glfw.KeyTab) CapsLock = Key(glfw.KeyCapsLock) Space = Key(glfw.KeySpace) Enter = Key(glfw.KeyEnter) Escape = Key(glfw.KeyEscape) Insert = Key(glfw.KeyInsert) PrintScreen = Key(glfw.KeyPrintScreen) Delete = Key(glfw.KeyDelete) PageUp = Key(glfw.KeyPageUp) PageDown = Key(glfw.KeyPageDown) Home = Key(glfw.KeyHome) End = Key(glfw.KeyEnd) Pause = Key(glfw.KeyPause) ScrollLock = Key(glfw.KeyScrollLock) ArrowLeft = Key(glfw.KeyLeft) ArrowRight = Key(glfw.KeyRight) ArrowDown = Key(glfw.KeyDown) ArrowUp = Key(glfw.KeyUp) LeftBracket = Key(glfw.KeyLeftBracket) LeftShift = Key(glfw.KeyLeftShift) LeftControl = Key(glfw.KeyLeftControl) LeftSuper = Key(glfw.KeyLeftSuper) LeftAlt = Key(glfw.KeyLeftAlt) RightBracket = Key(glfw.KeyRightBracket) RightShift = Key(glfw.KeyRightShift) RightControl = Key(glfw.KeyRightControl) RightSuper = Key(glfw.KeyRightSuper) RightAlt = Key(glfw.KeyRightAlt) Zero = Key(glfw.Key0) One = Key(glfw.Key1) Two = Key(glfw.Key2) Three = Key(glfw.Key3) Four = Key(glfw.Key4) Five = Key(glfw.Key5) Six = Key(glfw.Key6) Seven = Key(glfw.Key7) Eight = Key(glfw.Key8) Nine = Key(glfw.Key9) F1 = Key(glfw.KeyF1) F2 = Key(glfw.KeyF2) F3 = Key(glfw.KeyF3) F4 = Key(glfw.KeyF4) F5 = Key(glfw.KeyF5) F6 = Key(glfw.KeyF6) F7 = Key(glfw.KeyF7) F8 = Key(glfw.KeyF8) F9 = Key(glfw.KeyF9) F10 = Key(glfw.KeyF10) F11 = Key(glfw.KeyF11) F12 = Key(glfw.KeyF12) A = Key(glfw.KeyA) B = Key(glfw.KeyB) C = Key(glfw.KeyC) D = Key(glfw.KeyD) E = Key(glfw.KeyE) F = Key(glfw.KeyF) G = Key(glfw.KeyG) H = Key(glfw.KeyH) I = Key(glfw.KeyI) J = Key(glfw.KeyJ) K = Key(glfw.KeyK) L = Key(glfw.KeyL) M = Key(glfw.KeyM) N = Key(glfw.KeyN) O = Key(glfw.KeyO) P = Key(glfw.KeyP) Q = Key(glfw.KeyQ) R = Key(glfw.KeyR) S = Key(glfw.KeyS) T = Key(glfw.KeyT) U = Key(glfw.KeyU) V = Key(glfw.KeyV) W = Key(glfw.KeyW) X = Key(glfw.KeyX) Y = Key(glfw.KeyY) Z = Key(glfw.KeyZ) NumLock = Key(glfw.KeyNumLock) NumMultiply = Key(glfw.KeyKPMultiply) NumDivide = Key(glfw.KeyKPDivide) NumAdd = Key(glfw.KeyKPAdd) NumSubtract = Key(glfw.KeyKPSubtract) NumZero = Key(glfw.KeyKP0) NumOne = Key(glfw.KeyKP1) NumTwo = Key(glfw.KeyKP2) NumThree = Key(glfw.KeyKP3) NumFour = Key(glfw.KeyKP4) NumFive = Key(glfw.KeyKP5) NumSix = Key(glfw.KeyKP6) NumSeven = Key(glfw.KeyKP7) NumEight = Key(glfw.KeyKP8) NumNine = Key(glfw.KeyKP9) NumDecimal = Key(glfw.KeyKPDecimal) NumEnter = Key(glfw.KeyKPEnter) )
Variables ¶
This section is empty.
Functions ¶
func AnyKeyChanged ¶
func AnyKeyChanged() bool
func PointerButton ¶
func PointerButton(pb KeyPoint) button
func RegisterButton ¶
Types ¶
type InputSystem ¶
type InputSystem struct {
// contains filtered or unexported fields
}
var Input *InputSystem
func NewInputSystem ¶
func NewInputSystem() *InputSystem
func (*InputSystem) AdvanceFrame ¶
func (in *InputSystem) AdvanceFrame()
更新 Button 状态.... TODO 此处的输入状态,更新有bug!!
func (*InputSystem) AnyKeyChanged ¶
func (in *InputSystem) AnyKeyChanged() bool
func (*InputSystem) RegisterButton ¶
func (in *InputSystem) RegisterButton(name string, keys ...Key)
/ 将物理按键映射到虚拟按键
func (*InputSystem) Reset ¶
func (in *InputSystem) Reset()
func (*InputSystem) SetKeyEvent ¶
func (in *InputSystem) SetKeyEvent(key int, pressed bool)
更新 key 的状态
func (*InputSystem) SetPointerEvent ¶
func (in *InputSystem) SetPointerEvent(key int, pressed bool, x, y float32)
更新 Mouse/Touch 状态
type PointerInput ¶
type PointerInput struct { // The mouse pointer always has a pointer-id of 0 Id FingerId // The position and moved amount of pointer MousePos, MouseDelta f32.Vec2 // contains filtered or unexported fields }
// Touch & Mouse input go here
func PointerPosition ¶
func PointerPosition(pb KeyPoint) PointerInput
Click to show internal directories.
Click to hide internal directories.