controller

package
v0.0.0-...-a545287 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const BOTTOM float64 = 90
View Source
const BOTTOM_LEFT float64 = 135
View Source
const BOTTOM_RIGHT float64 = 45
View Source
const GamepadEventChannelSize = 1000
View Source
const KeyboardEventChannelSize = 1000
View Source
const LEFT float64 = 180
View Source
const RIGHT float64 = 0
View Source
const TOP float64 = 270
View Source
const TOP_LEFT float64 = 225
View Source
const TOP_RIGHT float64 = 315

Variables

This section is empty.

Functions

This section is empty.

Types

type Accelerometer

type Accelerometer struct {
	X int16
	Y int16
	Z int16
}

type Battery

type Battery struct {
	Capacity         byte
	IsCharging       bool
	IsCableConnected bool
}

type DualShock4

type DualShock4 struct {
	GamepadChannel GamepadEventChannel
	// contains filtered or unexported fields
}

func NewDualShock4

func NewDualShock4() *DualShock4

func (*DualShock4) EventChannel

func (ds *DualShock4) EventChannel() *GamepadEventChannel

func (*DualShock4) Projection

func (ds *DualShock4) Projection() *GamepadProjection

func (*DualShock4) Start

func (ds *DualShock4) Start()

func (*DualShock4) Stop

func (ds *DualShock4) Stop()

type Gamepad

type Gamepad interface {
	Projection() *GamepadProjection
	Start()
	Stop()
	EventChannel() *GamepadEventChannel
}

type GamepadEvent

type GamepadEvent struct {
	Name   GamepadEventType   // cross, gyroscope
	Action GamepadEventAction // press, release, swipe, move, update
	Data   interface{}
}

func NewGamepadEvent

func NewGamepadEvent(name GamepadEventType, action GamepadEventAction, data interface{}) *GamepadEvent

NewEvent returns a new Event and its associated data.

func (GamepadEvent) IsDPad

func (ge GamepadEvent) IsDPad() bool

type GamepadEventAction

type GamepadEventAction int
const (
	Press GamepadEventAction = iota
	Release
	Move
	Swipe
	Update
)

type GamepadEventChannel

type GamepadEventChannel chan *GamepadEvent

type GamepadEventType

type GamepadEventType string
const (
	EventTypeCross         GamepadEventType = "Cross"
	EventTypeCircle        GamepadEventType = "Circle"
	EventTypeSquare        GamepadEventType = "Square"
	EventTypeTriangle      GamepadEventType = "Triangle"
	EventTypeL1            GamepadEventType = "L1"
	EventTypeL2            GamepadEventType = "L2"
	EventTypeL3            GamepadEventType = "L3"
	EventTypeR1            GamepadEventType = "R1"
	EventTypeR2            GamepadEventType = "R2"
	EventTypeR3            GamepadEventType = "R3"
	EventTypeDPadUp        GamepadEventType = dPadPrefix + "Up"
	EventTypeDPadDown      GamepadEventType = dPadPrefix + "Down"
	EventTypeDPadLeft      GamepadEventType = dPadPrefix + "Left"
	EventTypeDPadRight     GamepadEventType = dPadPrefix + "Right"
	EventTypeShare         GamepadEventType = "Share"
	EventTypeOptions       GamepadEventType = "Options"
	EventTypePs            GamepadEventType = "Ps"
	EventTypeLeftStick     GamepadEventType = "LeftStick"
	EventTypeRightStick    GamepadEventType = "RightStick"
	EventTypeTouchpad      GamepadEventType = "Touchpad"
	EventTypeAccelerometer GamepadEventType = "Accelerometer"
	EventTypeGyroscope     GamepadEventType = "Gyroscope"
	EventTypeBattery       GamepadEventType = "Battery"
)

type GamepadProjection

type GamepadProjection struct {
	Cross         bool
	Circle        bool
	Square        bool
	Triangle      bool
	L1            bool
	L2            byte
	L3            bool
	R1            bool
	R2            byte
	R3            bool
	DPadUp        bool
	DPadDown      bool
	DPadLeft      bool
	DPadRight     bool
	Share         bool
	Options       bool
	Ps            bool
	LeftStick     Stick
	RightStick    Stick
	Touchpad      Touchpad
	Accelerometer Accelerometer
	Gyroscope     Gyroscope
	Battery       Battery
	// contains filtered or unexported fields
}

func NewGamepadProjection

func NewGamepadProjection() *GamepadProjection

func (*GamepadProjection) DPadDirection

func (gp *GamepadProjection) DPadDirection() *float64

type Gyroscope

type Gyroscope struct {
	Roll  int16
	Yaw   int16
	Pitch int16
}

type Keyboard

type Keyboard interface {
	Projection() *KeyboardProjection
	Start()
	Stop()
	EventChannel() *KeyboardEventChannel
}

type KeyboardEvent

type KeyboardEvent struct {
	Name   KeyboardEventType   // char, symbol
	Action KeyboardEventAction // press, hold, release
	Data   interface{}
}

func NewKeyboardEvent

func NewKeyboardEvent(name KeyboardEventType, action KeyboardEventAction, data interface{}) *KeyboardEvent

type KeyboardEventAction

type KeyboardEventAction int
const (
	PressKey KeyboardEventAction = iota
	HoldKey
	ReleaseKey
)

type KeyboardEventChannel

type KeyboardEventChannel chan *KeyboardEvent

type KeyboardEventType

type KeyboardEventType string
const (
	KeyEventTypeChar   KeyboardEventType = "char"
	KeyEventTypeSymbol KeyboardEventType = "symbol"
)

type KeyboardHard

type KeyboardHard struct {
	KeyboardChannel KeyboardEventChannel
	// contains filtered or unexported fields
}

func NewKeyboardHard

func NewKeyboardHard(keyboardChannel *KeyboardEventChannel) *KeyboardHard

func (*KeyboardHard) EventChannel

func (kbh *KeyboardHard) EventChannel() *KeyboardEventChannel

func (*KeyboardHard) Projection

func (kbh *KeyboardHard) Projection() *KeyboardProjection

func (*KeyboardHard) Start

func (kbh *KeyboardHard) Start()

func (*KeyboardHard) Stop

func (kbh *KeyboardHard) Stop()

type KeyboardProjection

type KeyboardProjection struct {
}

func NewKeyboardProjection

func NewKeyboardProjection() *KeyboardProjection

type Stick

type Stick struct {
	X byte
	Y byte
}

type Touch

type Touch struct {
	IsActive bool
	X        byte
	Y        byte
}

type Touchpad

type Touchpad struct {
	Press bool
	Swipe []Touch
}

Jump to

Keyboard shortcuts

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