vector

package
v0.0.0-...-c5d59ff Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Vector

type Vector struct {
	KeyVector         *bitset.BitSet
	ModifierVector    *bitset.BitSet
	MouseButtonVector *bitset.BitSet
}

Vector represents the state of keys, modifiers, and mouse buttons. It can be used to compare input states, and is intended to be used as such:

  • whatever manages system input keeps a "current" input vector and updates it
  • things that are listening for certain inputs will be compared using `Contains` and `Intersects` methods

func NewInputVector

func NewInputVector() *Vector

NewInputVector creates a new input vector

func (*Vector) Clear

func (iv *Vector) Clear() *Vector

Clear sets all bits in this input vector to 0

func (*Vector) Contains

func (iv *Vector) Contains(other *Vector) bool

Contains returns true if this input vector is a superset of the given input vector

func (*Vector) Intersects

func (iv *Vector) Intersects(other *Vector) bool

Intersects returns true if this input vector shares any bits with the given input vector

func (*Vector) SetKey

func (iv *Vector) SetKey(key constants.Key) *Vector

SetKey sets the corresponding key bit in the keys bitset

func (*Vector) SetKeys

func (iv *Vector) SetKeys(keys []constants.Key) *Vector

SetKeys sets multiple key bits in the keys bitset

func (*Vector) SetModifier

func (iv *Vector) SetModifier(mod constants.Modifier) *Vector

SetModifier sets the corresponding modifier bit in the modifier bitset

func (*Vector) SetModifiers

func (iv *Vector) SetModifiers(mods []constants.Modifier) *Vector

SetModifiers sets multiple modifier bits in the modifier bitset

func (*Vector) SetMouseButton

func (iv *Vector) SetMouseButton(button constants.MouseButton) *Vector

SetMouseButton sets the corresponding mouse button bit in the mouse button bitset

func (*Vector) SetMouseButtons

func (iv *Vector) SetMouseButtons(buttons []constants.MouseButton) *Vector

SetMouseButtons sets multiple mouse button bits in the mouse button bitset

Jump to

Keyboard shortcuts

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