internal

package
v2.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InputHandler

type InputHandler struct {
	Prev, Curr InputState

	PressEvents   [pixel.NumButtons]bool
	ReleaseEvents [pixel.NumButtons]bool

	MouseInsideWindow bool
	// contains filtered or unexported fields
}

func (*InputHandler) ButtonEvent

func (ih *InputHandler) ButtonEvent(button pixel.Button, action pixel.Action)

ButtonEvent sets the action state of a button for the next update

func (*InputHandler) CharEvent

func (ih *InputHandler) CharEvent(r rune)

CharEvent adds to the typed string for the next update

func (*InputHandler) MouseEnteredEvent

func (ih *InputHandler) MouseEnteredEvent(entered bool)

MouseEnteredEvent is called when the mouse enters or leaves the window

func (*InputHandler) MouseMoveEvent

func (ih *InputHandler) MouseMoveEvent(pos pixel.Vec)

MouseMoveEvent sets the mouse position for the next update

func (*InputHandler) MouseScrollEvent

func (ih *InputHandler) MouseScrollEvent(x, y float64)

MouseScrollEvent adds to the scroll offset for the next update

func (*InputHandler) SetMousePosition

func (ih *InputHandler) SetMousePosition(pos pixel.Vec)

SetMousePosition overrides the mouse position Called when the mouse is set to a point in the backend Window

func (*InputHandler) Update

func (ih *InputHandler) Update()

type InputState

type InputState struct {
	Mouse   pixel.Vec
	Buttons [pixel.NumButtons]bool
	Repeat  [pixel.NumButtons]bool
	Scroll  pixel.Vec
	Typed   string
}

type JoystickState

type JoystickState struct {
	Connected [pixel.NumJoysticks]bool
	Name      [pixel.NumJoysticks]string
	Buttons   [pixel.NumJoysticks][]pixel.Action
	Axis      [pixel.NumJoysticks][]float32
}

func (*JoystickState) GetAxis

func (js *JoystickState) GetAxis(joystick pixel.Joystick, axis pixel.GamepadAxis) float64

Returns the value of a joystick axis, returning 0 if the button or joystick is invalid.

func (*JoystickState) GetButton

func (js *JoystickState) GetButton(joystick pixel.Joystick, button pixel.GamepadButton) bool

Returns if a button on a joystick is down, returning false if the button or joystick is invalid.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL