Documentation
¶
Overview ¶
Package input tracks keyboard state from gogpu EventSource callbacks.
Prefer this over polling Native().Input() — held-key polling is unreliable on some Wayland compositors, while press/release events stay consistent.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Wire ¶
func Wire(es gpucontext.EventSource, keys *Keyboard, edges *Edges)
Wire registers Keyboard and/or Edges on an EventSource. Pass nil for either side you do not need.
Types ¶
type Edges ¶
type Edges struct {
// contains filtered or unexported fields
}
Edges latches press and release events until the sim consumes them. Useful for one-shot actions (pause, confirm) that must not repeat every frame.
func (*Edges) ConsumePressed ¶
func (e *Edges) ConsumePressed(key gpucontext.Key) bool
ConsumePressed returns true once per press edge for key.
func (*Edges) ConsumeReleased ¶
func (e *Edges) ConsumeReleased(key gpucontext.Key) bool
ConsumeReleased returns true once per release edge for key.
func (*Edges) OnPress ¶
func (e *Edges) OnPress(key gpucontext.Key)
OnPress records a key-down edge. Call from EventSource OnKeyPress.
func (*Edges) OnRelease ¶
func (e *Edges) OnRelease(key gpucontext.Key)
OnRelease records a key-up edge. Call from EventSource OnKeyRelease.