Documentation
¶
Overview ¶
Package input defines backend-neutral input snapshots and events consumed by game. It should not know about Ragnarok gameplay, rendering, or network packets.
Index ¶
- type Key
- type KeyCode
- type MouseButton
- type State
- func (s *State) AddTextInput(text string)
- func (s *State) AddWheel(x, y float64)
- func (s *State) ConsumeKeyCodePress(code KeyCode) bool
- func (s *State) EndFrame()
- func (s *State) JustPressed(key Key) bool
- func (s *State) KeyCodeDown(code KeyCode) bool
- func (s *State) KeyCodeJustPressed(code KeyCode) bool
- func (s *State) KeyCodeJustReleased(code KeyCode) bool
- func (s *State) MouseJustPressed(button MouseButton) bool
- func (s *State) MouseJustReleased(button MouseButton) bool
- func (s *State) MousePressed(button MouseButton) bool
- func (s *State) Pressed(key Key) bool
- func (s *State) ResetKeyboard()
- func (s *State) SetKey(key Key, pressed bool)
- func (s *State) SetKeyCode(code KeyCode, pressed bool)
- func (s *State) SetMouseButton(button MouseButton, pressed bool)
- func (s *State) SetMousePosition(x, y int)
- func (s *State) SetTouch(id TouchID, x, y int, pressed bool)
- func (s *State) TextInput() string
- func (s *State) Update()
- type TouchID
- type TouchPoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyCode ¶ added in v0.7.0
type KeyCode = gpucontext.Key
KeyCode identifies a physical keyboard position. Its names follow the browser KeyboardEvent.code convention (KeyW, Digit1, ArrowUp, and so on).
func KeyCodeFromName ¶ added in v0.7.0
KeyCodeFromName resolves a layout-independent physical key name. Names use the same vocabulary as browser KeyboardEvent.code so scripts remain clear across QWERTY, AZERTY, and other layouts.
type MouseButton ¶
type MouseButton int
const ( MouseButtonLeft MouseButton = iota MouseButtonRight )
type State ¶
type State struct {
MouseX int
MouseY int
MouseDX int
MouseDY int
WheelX float64
WheelY float64
TouchPoints []TouchPoint
PinchDelta float64
// contains filtered or unexported fields
}
func (*State) AddTextInput ¶
func (*State) ConsumeKeyCodePress ¶ added in v0.7.0
ConsumeKeyCodePress reports a new physical key press once and prevents other physical-key consumers from acting on the same edge. Held state and layout-translated text input are left unchanged.
func (*State) JustPressed ¶
func (*State) KeyCodeDown ¶ added in v0.7.0
func (*State) KeyCodeJustPressed ¶ added in v0.7.0
func (*State) KeyCodeJustReleased ¶ added in v0.7.0
func (*State) MouseJustPressed ¶
func (s *State) MouseJustPressed(button MouseButton) bool
func (*State) MouseJustReleased ¶
func (s *State) MouseJustReleased(button MouseButton) bool
func (*State) MousePressed ¶
func (s *State) MousePressed(button MouseButton) bool
func (*State) ResetKeyboard ¶ added in v0.11.0
func (s *State) ResetKeyboard()
ResetKeyboard forgets held keys and pending keyboard input after focus loss. Releases may happen in another window and never reach us. Clear the edge history too, so cancellation does not trigger actions bound to key releases.
func (*State) SetKeyCode ¶ added in v0.7.0
func (*State) SetMouseButton ¶
func (s *State) SetMouseButton(button MouseButton, pressed bool)