input

package
v0.0.0-...-d4a0833 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: Unlicense Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Keyboard

type Keyboard struct {
	// contains filtered or unexported fields
}

Keyboard key wrapper

func GetKeyboard

func GetKeyboard() *Keyboard

GetKeyboard return static keyboard

func (*Keyboard) IsKeyDown

func (keyboard *Keyboard) IsKeyDown(key keyboard.Key) bool

IsKeyDown Check if a specific key is pressed

func (*Keyboard) ReceiveMessage

func (keyboard *Keyboard) ReceiveMessage(message tinygametools.Event)

CallbackMouseMove Event manager message receiver. Used to catch key events from the window library

func (*Keyboard) SendMessage

func (keyboard *Keyboard) SendMessage() event.IMessage

type Manager

type Manager struct {
	engine.Manager
	MouseCoordinates mgl64.Vec2
	// contains filtered or unexported fields
}

manager handles user input from mouse and keyboard in a specific window

func NewInputManager

func NewInputManager(win *tinygametools.Window, mouse *tinygametools.Mouse, keyboard *tinygametools.Keyboard) *Manager

NewInputManager

func (*Manager) KeyCallback

func (manager *Manager) KeyCallback(window *glfw.Window, key glfw.Key, scancode int, action glfw.Action, mods glfw.ModifierKey)

KeyCallback called whenever a key event occurs

func (*Manager) MouseCallback

func (manager *Manager) MouseCallback(window *glfw.Window, xpos float64, ypos float64)

MouseCallback called whenever a mouse event occurs

func (*Manager) PostUpdate

func (manager *Manager) PostUpdate()

func (*Manager) Register

func (manager *Manager) Register()

Register prepares this manager to listen for events from a window

func (*Manager) Unregister

func (manager *Manager) Unregister()

Unregister

func (*Manager) Update

func (manager *Manager) Update(dt float64)

Update prepares data constructs that represent mouse & keyboard state with updated information on the current input state.

type Mouse

type Mouse struct {
	// contains filtered or unexported fields
}

Mouse information, about change from previous poll. Note: Mouse is a struct containing mouse information, it doesn't have any direct interaction with the window

func GetMouse

func GetMouse() *Mouse

GetMouse return static mouse

func (*Mouse) CallbackMouseMove

func (mouse *Mouse) CallbackMouseMove(message tinygametools.Event)

CallbackMouseMove mouse receives updated info from the event queue about mouse interaction

func (*Mouse) GetCoordinates

func (mouse *Mouse) GetCoordinates() mgl32.Vec2

GetCoordinates return current mouse position

func (*Mouse) PostUpdate

func (mouse *Mouse) PostUpdate()

func (*Mouse) SendMessage

func (mouse *Mouse) SendMessage() event.IMessage

func (*Mouse) Update

func (mouse *Mouse) Update()

Update The Mouse should be reset to screen center

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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