controllers

package
v0.1.107 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ControllerStream_name = map[int32]string{
		0: "CONTROLLER_STREAM_UNKNOWN",
		1: "CONTROLLER_STREAM_NONE",
		2: "CONTROLLER_STREAM_LIVE",
		3: "CONTROLLER_STREAM_UNFOCUSED",
		4: "CONTROLLER_STREAM_STALE",
	}
	ControllerStream_value = map[string]int32{
		"CONTROLLER_STREAM_UNKNOWN":   0,
		"CONTROLLER_STREAM_NONE":      1,
		"CONTROLLER_STREAM_LIVE":      2,
		"CONTROLLER_STREAM_UNFOCUSED": 3,
		"CONTROLLER_STREAM_STALE":     4,
	}
)

Enum value maps for ControllerStream.

View Source
var (
	GamepadButton_name = map[int32]string{
		0:  "GAMEPAD_BUTTON_UNKNOWN",
		1:  "GAMEPAD_BUTTON_SOUTH",
		2:  "GAMEPAD_BUTTON_EAST",
		3:  "GAMEPAD_BUTTON_WEST",
		4:  "GAMEPAD_BUTTON_NORTH",
		5:  "GAMEPAD_BUTTON_BACK",
		6:  "GAMEPAD_BUTTON_GUIDE",
		7:  "GAMEPAD_BUTTON_START",
		8:  "GAMEPAD_BUTTON_LEFT_STICK",
		9:  "GAMEPAD_BUTTON_RIGHT_STICK",
		10: "GAMEPAD_BUTTON_LEFT_SHOULDER",
		11: "GAMEPAD_BUTTON_RIGHT_SHOULDER",
		12: "GAMEPAD_BUTTON_DPAD_UP",
		13: "GAMEPAD_BUTTON_DPAD_DOWN",
		14: "GAMEPAD_BUTTON_DPAD_LEFT",
		15: "GAMEPAD_BUTTON_DPAD_RIGHT",
		16: "GAMEPAD_BUTTON_MISC",
		17: "GAMEPAD_BUTTON_TOUCHPAD",
	}
	GamepadButton_value = map[string]int32{
		"GAMEPAD_BUTTON_UNKNOWN":        0,
		"GAMEPAD_BUTTON_SOUTH":          1,
		"GAMEPAD_BUTTON_EAST":           2,
		"GAMEPAD_BUTTON_WEST":           3,
		"GAMEPAD_BUTTON_NORTH":          4,
		"GAMEPAD_BUTTON_BACK":           5,
		"GAMEPAD_BUTTON_GUIDE":          6,
		"GAMEPAD_BUTTON_START":          7,
		"GAMEPAD_BUTTON_LEFT_STICK":     8,
		"GAMEPAD_BUTTON_RIGHT_STICK":    9,
		"GAMEPAD_BUTTON_LEFT_SHOULDER":  10,
		"GAMEPAD_BUTTON_RIGHT_SHOULDER": 11,
		"GAMEPAD_BUTTON_DPAD_UP":        12,
		"GAMEPAD_BUTTON_DPAD_DOWN":      13,
		"GAMEPAD_BUTTON_DPAD_LEFT":      14,
		"GAMEPAD_BUTTON_DPAD_RIGHT":     15,
		"GAMEPAD_BUTTON_MISC":           16,
		"GAMEPAD_BUTTON_TOUCHPAD":       17,
	}
)

Enum value maps for GamepadButton.

Functions

This section is empty.

Types

type Controller

type Controller struct {

	// Info describes the device.
	Info *ControllerInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
	// State is its inputs now, with the presses and releases since the mod's
	// previous frame.
	State *ControllerState `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"`
	// contains filtered or unexported fields
}

Controller is one device as a mod reads it.

func (*Controller) CloneMessageVT

func (m *Controller) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Controller) CloneVT

func (m *Controller) CloneVT() *Controller

func (*Controller) EqualMessageVT

func (this *Controller) EqualMessageVT(thatMsg any) bool

func (*Controller) EqualVT

func (this *Controller) EqualVT(that *Controller) bool

func (*Controller) GetInfo

func (x *Controller) GetInfo() *ControllerInfo

func (*Controller) GetState

func (x *Controller) GetState() *ControllerState

func (*Controller) MarshalJSON

func (x *Controller) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Controller to JSON.

func (*Controller) MarshalProtoJSON

func (x *Controller) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the Controller message to JSON.

func (*Controller) MarshalProtoText

func (x *Controller) MarshalProtoText() string

func (*Controller) MarshalToSizedBufferVT

func (m *Controller) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Controller) MarshalToVT

func (m *Controller) MarshalToVT(dAtA []byte) (int, error)

func (*Controller) MarshalVT

func (m *Controller) MarshalVT() (dAtA []byte, err error)

func (*Controller) ProtoMessage

func (*Controller) ProtoMessage()

func (*Controller) Reset

func (x *Controller) Reset()

func (*Controller) SizeVT

func (m *Controller) SizeVT() (n int)

func (*Controller) String

func (x *Controller) String() string

func (*Controller) UnmarshalJSON

func (x *Controller) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Controller from JSON.

func (*Controller) UnmarshalProtoJSON

func (x *Controller) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the Controller message from JSON.

func (*Controller) UnmarshalVT

func (m *Controller) UnmarshalVT(dAtA []byte) error

type ControllerFrame

type ControllerFrame struct {

	// Epoch is the want epoch this frame answers, from the ControllerWant the
	// client last received. The host keeps only frames of the current epoch.
	Epoch uint32 `protobuf:"varint,1,opt,name=epoch,proto3" json:"epoch,omitempty"`
	// Full is true when Added lists every device and Changed every device's
	// state, replacing what the host held. A client sends a full frame first
	// for each epoch.
	Full bool `protobuf:"varint,2,opt,name=full,proto3" json:"full,omitempty"`
	// Focused is true when the player's game window has focus. An unfocused
	// client reports every device with nothing held and every axis at rest.
	Focused bool `protobuf:"varint,3,opt,name=focused,proto3" json:"focused,omitempty"`
	// Added describes the devices attached since the previous frame.
	Added []*ControllerInfo `protobuf:"bytes,4,rep,name=added,proto3" json:"added,omitempty"`
	// Changed holds the whole state of each device whose state changed.
	Changed []*ControllerState `protobuf:"bytes,5,rep,name=changed,proto3" json:"changed,omitempty"`
	// Removed lists the ids of the devices detached since the previous frame.
	Removed []uint32 `protobuf:"varint,6,rep,packed,name=removed,proto3" json:"removed,omitempty"`
	// contains filtered or unexported fields
}

ControllerFrame is what a client sends on its stream: the whole set of devices first, then only what changed, and a frame with no change as a heartbeat at least every 50 milliseconds.

func (*ControllerFrame) CloneMessageVT

func (m *ControllerFrame) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*ControllerFrame) CloneVT

func (m *ControllerFrame) CloneVT() *ControllerFrame

func (*ControllerFrame) EqualMessageVT

func (this *ControllerFrame) EqualMessageVT(thatMsg any) bool

func (*ControllerFrame) EqualVT

func (this *ControllerFrame) EqualVT(that *ControllerFrame) bool

func (*ControllerFrame) GetAdded

func (x *ControllerFrame) GetAdded() []*ControllerInfo

func (*ControllerFrame) GetChanged

func (x *ControllerFrame) GetChanged() []*ControllerState

func (*ControllerFrame) GetEpoch

func (x *ControllerFrame) GetEpoch() uint32

func (*ControllerFrame) GetFocused

func (x *ControllerFrame) GetFocused() bool

func (*ControllerFrame) GetFull

func (x *ControllerFrame) GetFull() bool

func (*ControllerFrame) GetRemoved

func (x *ControllerFrame) GetRemoved() []uint32

func (*ControllerFrame) MarshalJSON

func (x *ControllerFrame) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ControllerFrame to JSON.

func (*ControllerFrame) MarshalProtoJSON

func (x *ControllerFrame) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the ControllerFrame message to JSON.

func (*ControllerFrame) MarshalProtoText

func (x *ControllerFrame) MarshalProtoText() string

func (*ControllerFrame) MarshalToSizedBufferVT

func (m *ControllerFrame) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ControllerFrame) MarshalToVT

func (m *ControllerFrame) MarshalToVT(dAtA []byte) (int, error)

func (*ControllerFrame) MarshalVT

func (m *ControllerFrame) MarshalVT() (dAtA []byte, err error)

func (*ControllerFrame) ProtoMessage

func (*ControllerFrame) ProtoMessage()

func (*ControllerFrame) Reset

func (x *ControllerFrame) Reset()

func (*ControllerFrame) SizeVT

func (m *ControllerFrame) SizeVT() (n int)

func (*ControllerFrame) String

func (x *ControllerFrame) String() string

func (*ControllerFrame) UnmarshalJSON

func (x *ControllerFrame) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the ControllerFrame from JSON.

func (*ControllerFrame) UnmarshalProtoJSON

func (x *ControllerFrame) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the ControllerFrame message from JSON.

func (*ControllerFrame) UnmarshalVT

func (m *ControllerFrame) UnmarshalVT(dAtA []byte) error

type ControllerFrames

type ControllerFrames struct {

	// Player is the player's slot.
	Player int32 `protobuf:"varint,1,opt,name=player,proto3" json:"player,omitempty"`
	// Frames holds the frames, oldest first.
	Frames []*ControllerFrame `protobuf:"bytes,2,rep,name=frames,proto3" json:"frames,omitempty"`
	// Ended is true when the player's stream ended, after its last frame: the
	// client disconnected or the link dropped.
	Ended bool `protobuf:"varint,3,opt,name=ended,proto3" json:"ended,omitempty"`
	// contains filtered or unexported fields
}

ControllerFrames carries one player's controller frames to the host, in the order their client sent them. The game server sends a player's frames only from the stream it bound to that player's own client.

func (*ControllerFrames) CloneMessageVT

func (m *ControllerFrames) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*ControllerFrames) CloneVT

func (m *ControllerFrames) CloneVT() *ControllerFrames

func (*ControllerFrames) EqualMessageVT

func (this *ControllerFrames) EqualMessageVT(thatMsg any) bool

func (*ControllerFrames) EqualVT

func (this *ControllerFrames) EqualVT(that *ControllerFrames) bool

func (*ControllerFrames) GetEnded

func (x *ControllerFrames) GetEnded() bool

func (*ControllerFrames) GetFrames

func (x *ControllerFrames) GetFrames() []*ControllerFrame

func (*ControllerFrames) GetPlayer

func (x *ControllerFrames) GetPlayer() int32

func (*ControllerFrames) MarshalJSON

func (x *ControllerFrames) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ControllerFrames to JSON.

func (*ControllerFrames) MarshalProtoJSON

func (x *ControllerFrames) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the ControllerFrames message to JSON.

func (*ControllerFrames) MarshalProtoText

func (x *ControllerFrames) MarshalProtoText() string

func (*ControllerFrames) MarshalToSizedBufferVT

func (m *ControllerFrames) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ControllerFrames) MarshalToVT

func (m *ControllerFrames) MarshalToVT(dAtA []byte) (int, error)

func (*ControllerFrames) MarshalVT

func (m *ControllerFrames) MarshalVT() (dAtA []byte, err error)

func (*ControllerFrames) ProtoMessage

func (*ControllerFrames) ProtoMessage()

func (*ControllerFrames) Reset

func (x *ControllerFrames) Reset()

func (*ControllerFrames) SizeVT

func (m *ControllerFrames) SizeVT() (n int)

func (*ControllerFrames) String

func (x *ControllerFrames) String() string

func (*ControllerFrames) UnmarshalJSON

func (x *ControllerFrames) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the ControllerFrames from JSON.

func (*ControllerFrames) UnmarshalProtoJSON

func (x *ControllerFrames) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the ControllerFrames message from JSON.

func (*ControllerFrames) UnmarshalVT

func (m *ControllerFrames) UnmarshalVT(dAtA []byte) error

type ControllerInfo

type ControllerInfo struct {

	// Id identifies the device within its stream for as long as it stays
	// attached. A device plugged in again gets a new id.
	Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// Name is the device's name, such as "Xbox Series X Controller".
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	// Guid is SDL's joystick GUID in hexadecimal, which identifies the model
	// and the way it is attached.
	Guid string `protobuf:"bytes,3,opt,name=guid,proto3" json:"guid,omitempty"`
	// Vendor and Product are the USB vendor and product IDs, or zero when the
	// device does not report them.
	Vendor  uint32 `protobuf:"varint,4,opt,name=vendor,proto3" json:"vendor,omitempty"`
	Product uint32 `protobuf:"varint,5,opt,name=product,proto3" json:"product,omitempty"`
	// Axes, Buttons and Hats count the device's raw inputs, which State's
	// lists follow.
	Axes    uint32 `protobuf:"varint,6,opt,name=axes,proto3" json:"axes,omitempty"`
	Buttons uint32 `protobuf:"varint,7,opt,name=buttons,proto3" json:"buttons,omitempty"`
	Hats    uint32 `protobuf:"varint,8,opt,name=hats,proto3" json:"hats,omitempty"`
	// Gamepad is true when SDL knows the device's gamepad layout, so State
	// carries the gamepad layer.
	Gamepad bool `protobuf:"varint,9,opt,name=gamepad,proto3" json:"gamepad,omitempty"`
	// contains filtered or unexported fields
}

ControllerInfo describes one device a client reads.

func (*ControllerInfo) CloneMessageVT

func (m *ControllerInfo) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*ControllerInfo) CloneVT

func (m *ControllerInfo) CloneVT() *ControllerInfo

func (*ControllerInfo) EqualMessageVT

func (this *ControllerInfo) EqualMessageVT(thatMsg any) bool

func (*ControllerInfo) EqualVT

func (this *ControllerInfo) EqualVT(that *ControllerInfo) bool

func (*ControllerInfo) GetAxes

func (x *ControllerInfo) GetAxes() uint32

func (*ControllerInfo) GetButtons

func (x *ControllerInfo) GetButtons() uint32

func (*ControllerInfo) GetGamepad

func (x *ControllerInfo) GetGamepad() bool

func (*ControllerInfo) GetGuid

func (x *ControllerInfo) GetGuid() string

func (*ControllerInfo) GetHats

func (x *ControllerInfo) GetHats() uint32

func (*ControllerInfo) GetId

func (x *ControllerInfo) GetId() uint32

func (*ControllerInfo) GetName

func (x *ControllerInfo) GetName() string

func (*ControllerInfo) GetProduct

func (x *ControllerInfo) GetProduct() uint32

func (*ControllerInfo) GetVendor

func (x *ControllerInfo) GetVendor() uint32

func (*ControllerInfo) MarshalJSON

func (x *ControllerInfo) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ControllerInfo to JSON.

func (*ControllerInfo) MarshalProtoJSON

func (x *ControllerInfo) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the ControllerInfo message to JSON.

func (*ControllerInfo) MarshalProtoText

func (x *ControllerInfo) MarshalProtoText() string

func (*ControllerInfo) MarshalToSizedBufferVT

func (m *ControllerInfo) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ControllerInfo) MarshalToVT

func (m *ControllerInfo) MarshalToVT(dAtA []byte) (int, error)

func (*ControllerInfo) MarshalVT

func (m *ControllerInfo) MarshalVT() (dAtA []byte, err error)

func (*ControllerInfo) ProtoMessage

func (*ControllerInfo) ProtoMessage()

func (*ControllerInfo) Reset

func (x *ControllerInfo) Reset()

func (*ControllerInfo) SizeVT

func (m *ControllerInfo) SizeVT() (n int)

func (*ControllerInfo) String

func (x *ControllerInfo) String() string

func (*ControllerInfo) UnmarshalJSON

func (x *ControllerInfo) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the ControllerInfo from JSON.

func (*ControllerInfo) UnmarshalProtoJSON

func (x *ControllerInfo) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the ControllerInfo message from JSON.

func (*ControllerInfo) UnmarshalVT

func (m *ControllerInfo) UnmarshalVT(dAtA []byte) error

type ControllerState

type ControllerState struct {

	// Id is the device's id in ControllerInfo.
	Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// Axes holds each raw axis from -1 to 1, in the device's order. A radio
	// transmitter's channels are its axes.
	Axes []float32 `protobuf:"fixed32,2,rep,packed,name=axes,proto3" json:"axes,omitempty"`
	// Buttons holds whether each raw button is held, in the device's order.
	Buttons []bool `protobuf:"varint,3,rep,packed,name=buttons,proto3" json:"buttons,omitempty"`
	// Hats holds each hat's position as SDL's mask: 1 up, 2 right, 4 down and
	// 8 left, combined on a diagonal, and 0 centered.
	Hats []uint32 `protobuf:"varint,4,rep,packed,name=hats,proto3" json:"hats,omitempty"`
	// Pressed and Released list the raw buttons, by index, pressed and
	// released since the previous state, once for each press.
	Pressed  []uint32 `protobuf:"varint,5,rep,packed,name=pressed,proto3" json:"pressed,omitempty"`
	Released []uint32 `protobuf:"varint,6,rep,packed,name=released,proto3" json:"released,omitempty"`
	// Gamepad is the gamepad layer, when the device has one.
	Gamepad *Gamepad `protobuf:"bytes,7,opt,name=gamepad,proto3" json:"gamepad,omitempty"`
	// contains filtered or unexported fields
}

ControllerState is one device's inputs, the raw joystick layer always and the gamepad layer when SDL knows the device.

func (*ControllerState) CloneMessageVT

func (m *ControllerState) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*ControllerState) CloneVT

func (m *ControllerState) CloneVT() *ControllerState

func (*ControllerState) EqualMessageVT

func (this *ControllerState) EqualMessageVT(thatMsg any) bool

func (*ControllerState) EqualVT

func (this *ControllerState) EqualVT(that *ControllerState) bool

func (*ControllerState) GetAxes

func (x *ControllerState) GetAxes() []float32

func (*ControllerState) GetButtons

func (x *ControllerState) GetButtons() []bool

func (*ControllerState) GetGamepad

func (x *ControllerState) GetGamepad() *Gamepad

func (*ControllerState) GetHats

func (x *ControllerState) GetHats() []uint32

func (*ControllerState) GetId

func (x *ControllerState) GetId() uint32

func (*ControllerState) GetPressed

func (x *ControllerState) GetPressed() []uint32

func (*ControllerState) GetReleased

func (x *ControllerState) GetReleased() []uint32

func (*ControllerState) MarshalJSON

func (x *ControllerState) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ControllerState to JSON.

func (*ControllerState) MarshalProtoJSON

func (x *ControllerState) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the ControllerState message to JSON.

func (*ControllerState) MarshalProtoText

func (x *ControllerState) MarshalProtoText() string

func (*ControllerState) MarshalToSizedBufferVT

func (m *ControllerState) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ControllerState) MarshalToVT

func (m *ControllerState) MarshalToVT(dAtA []byte) (int, error)

func (*ControllerState) MarshalVT

func (m *ControllerState) MarshalVT() (dAtA []byte, err error)

func (*ControllerState) ProtoMessage

func (*ControllerState) ProtoMessage()

func (*ControllerState) Reset

func (x *ControllerState) Reset()

func (*ControllerState) SizeVT

func (m *ControllerState) SizeVT() (n int)

func (*ControllerState) String

func (x *ControllerState) String() string

func (*ControllerState) UnmarshalJSON

func (x *ControllerState) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the ControllerState from JSON.

func (*ControllerState) UnmarshalProtoJSON

func (x *ControllerState) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the ControllerState message from JSON.

func (*ControllerState) UnmarshalVT

func (m *ControllerState) UnmarshalVT(dAtA []byte) error

type ControllerStream

type ControllerStream int32

ControllerStream is the state of the stream that brings one player's controllers to the host, as a mod reads it.

const (
	// CONTROLLER_STREAM_UNKNOWN is never sent.
	ControllerStream_CONTROLLER_STREAM_UNKNOWN ControllerStream = 0
	// CONTROLLER_STREAM_NONE means no client streams the player's controllers
	// yet: none is linked, the link dropped, or the client has not answered
	// the watch. A mod sees no controllers.
	ControllerStream_CONTROLLER_STREAM_NONE ControllerStream = 1
	// CONTROLLER_STREAM_LIVE means frames arrive and the game has focus.
	ControllerStream_CONTROLLER_STREAM_LIVE ControllerStream = 2
	// CONTROLLER_STREAM_UNFOCUSED means frames arrive while the player's game
	// window does not have focus. The controllers are listed with nothing held
	// and every axis at rest.
	ControllerStream_CONTROLLER_STREAM_UNFOCUSED ControllerStream = 3
	// CONTROLLER_STREAM_STALE means the stream is linked but no frame arrived
	// within its deadline. The controllers keep their last state, so a short
	// gap does not cut a held throttle; the mod decides what a long one means.
	ControllerStream_CONTROLLER_STREAM_STALE ControllerStream = 4
)

func (ControllerStream) Enum

func (ControllerStream) MarshalJSON

func (x ControllerStream) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ControllerStream to JSON.

func (ControllerStream) MarshalProtoJSON

func (x ControllerStream) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the ControllerStream to JSON.

func (ControllerStream) MarshalProtoText

func (x ControllerStream) MarshalProtoText() string

func (ControllerStream) MarshalText

func (x ControllerStream) MarshalText() ([]byte, error)

MarshalText marshals the ControllerStream to text.

func (ControllerStream) String

func (x ControllerStream) String() string

func (*ControllerStream) UnmarshalJSON

func (x *ControllerStream) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the ControllerStream from JSON.

func (*ControllerStream) UnmarshalProtoJSON

func (x *ControllerStream) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the ControllerStream from JSON.

func (*ControllerStream) UnmarshalText

func (x *ControllerStream) UnmarshalText(b []byte) error

UnmarshalText unmarshals the ControllerStream from text.

type ControllerWant

type ControllerWant struct {

	// Player is the player's slot.
	Player int32 `protobuf:"varint,1,opt,name=player,proto3" json:"player,omitempty"`
	// Epoch counts the watches of this player's slot: it grows each time a mod
	// starts watching after none did, and never repeats while the host runs.
	// The client answers each new epoch with a full frame, so a watch that ends
	// and starts again before the client hears either still gets a full frame.
	Epoch uint32 `protobuf:"varint,2,opt,name=epoch,proto3" json:"epoch,omitempty"`
	// contains filtered or unexported fields
}

ControllerWant asks a player's client to stream their controllers.

func (*ControllerWant) CloneMessageVT

func (m *ControllerWant) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*ControllerWant) CloneVT

func (m *ControllerWant) CloneVT() *ControllerWant

func (*ControllerWant) EqualMessageVT

func (this *ControllerWant) EqualMessageVT(thatMsg any) bool

func (*ControllerWant) EqualVT

func (this *ControllerWant) EqualVT(that *ControllerWant) bool

func (*ControllerWant) GetEpoch

func (x *ControllerWant) GetEpoch() uint32

func (*ControllerWant) GetPlayer

func (x *ControllerWant) GetPlayer() int32

func (*ControllerWant) MarshalJSON

func (x *ControllerWant) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ControllerWant to JSON.

func (*ControllerWant) MarshalProtoJSON

func (x *ControllerWant) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the ControllerWant message to JSON.

func (*ControllerWant) MarshalProtoText

func (x *ControllerWant) MarshalProtoText() string

func (*ControllerWant) MarshalToSizedBufferVT

func (m *ControllerWant) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ControllerWant) MarshalToVT

func (m *ControllerWant) MarshalToVT(dAtA []byte) (int, error)

func (*ControllerWant) MarshalVT

func (m *ControllerWant) MarshalVT() (dAtA []byte, err error)

func (*ControllerWant) ProtoMessage

func (*ControllerWant) ProtoMessage()

func (*ControllerWant) Reset

func (x *ControllerWant) Reset()

func (*ControllerWant) SizeVT

func (m *ControllerWant) SizeVT() (n int)

func (*ControllerWant) String

func (x *ControllerWant) String() string

func (*ControllerWant) UnmarshalJSON

func (x *ControllerWant) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the ControllerWant from JSON.

func (*ControllerWant) UnmarshalProtoJSON

func (x *ControllerWant) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the ControllerWant message from JSON.

func (*ControllerWant) UnmarshalVT

func (m *ControllerWant) UnmarshalVT(dAtA []byte) error

type ControllerWants

type ControllerWants struct {

	// Wants holds one entry per watched player.
	Wants []*ControllerWant `protobuf:"bytes,1,rep,name=wants,proto3" json:"wants,omitempty"`
	// contains filtered or unexported fields
}

ControllerWants is every player whose controllers some mod watches. A player missing from it is not wanted, and their client closes its devices.

func (*ControllerWants) CloneMessageVT

func (m *ControllerWants) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*ControllerWants) CloneVT

func (m *ControllerWants) CloneVT() *ControllerWants

func (*ControllerWants) EqualMessageVT

func (this *ControllerWants) EqualMessageVT(thatMsg any) bool

func (*ControllerWants) EqualVT

func (this *ControllerWants) EqualVT(that *ControllerWants) bool

func (*ControllerWants) GetWants

func (x *ControllerWants) GetWants() []*ControllerWant

func (*ControllerWants) MarshalJSON

func (x *ControllerWants) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ControllerWants to JSON.

func (*ControllerWants) MarshalProtoJSON

func (x *ControllerWants) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the ControllerWants message to JSON.

func (*ControllerWants) MarshalProtoText

func (x *ControllerWants) MarshalProtoText() string

func (*ControllerWants) MarshalToSizedBufferVT

func (m *ControllerWants) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ControllerWants) MarshalToVT

func (m *ControllerWants) MarshalToVT(dAtA []byte) (int, error)

func (*ControllerWants) MarshalVT

func (m *ControllerWants) MarshalVT() (dAtA []byte, err error)

func (*ControllerWants) ProtoMessage

func (*ControllerWants) ProtoMessage()

func (*ControllerWants) Reset

func (x *ControllerWants) Reset()

func (*ControllerWants) SizeVT

func (m *ControllerWants) SizeVT() (n int)

func (*ControllerWants) String

func (x *ControllerWants) String() string

func (*ControllerWants) UnmarshalJSON

func (x *ControllerWants) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the ControllerWants from JSON.

func (*ControllerWants) UnmarshalProtoJSON

func (x *ControllerWants) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the ControllerWants message from JSON.

func (*ControllerWants) UnmarshalVT

func (m *ControllerWants) UnmarshalVT(dAtA []byte) error

type Gamepad

type Gamepad struct {

	// LeftX, LeftY, RightX and RightY are the sticks, from -1 to 1, with x
	// positive to the right and y positive down, as SDL reports them.
	LeftX  float32 `protobuf:"fixed32,1,opt,name=left_x,json=leftX,proto3" json:"leftX,omitempty"`
	LeftY  float32 `protobuf:"fixed32,2,opt,name=left_y,json=leftY,proto3" json:"leftY,omitempty"`
	RightX float32 `protobuf:"fixed32,3,opt,name=right_x,json=rightX,proto3" json:"rightX,omitempty"`
	RightY float32 `protobuf:"fixed32,4,opt,name=right_y,json=rightY,proto3" json:"rightY,omitempty"`
	// LeftTrigger and RightTrigger run from 0 at rest to 1 fully pulled.
	LeftTrigger  float32 `protobuf:"fixed32,5,opt,name=left_trigger,json=leftTrigger,proto3" json:"leftTrigger,omitempty"`
	RightTrigger float32 `protobuf:"fixed32,6,opt,name=right_trigger,json=rightTrigger,proto3" json:"rightTrigger,omitempty"`
	// Held lists the buttons held now.
	Held []GamepadButton `protobuf:"varint,7,rep,packed,name=held,proto3" json:"held,omitempty"`
	// Pressed and Released list the buttons pressed and released since the
	// previous state, once for each press, so a tap shorter than a server frame
	// is listed in both.
	Pressed  []GamepadButton `protobuf:"varint,8,rep,packed,name=pressed,proto3" json:"pressed,omitempty"`
	Released []GamepadButton `protobuf:"varint,9,rep,packed,name=released,proto3" json:"released,omitempty"`
	// contains filtered or unexported fields
}

Gamepad is a device's gamepad layer, with named sticks, triggers and buttons, for a device whose layout SDL knows.

func (*Gamepad) CloneMessageVT

func (m *Gamepad) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Gamepad) CloneVT

func (m *Gamepad) CloneVT() *Gamepad

func (*Gamepad) EqualMessageVT

func (this *Gamepad) EqualMessageVT(thatMsg any) bool

func (*Gamepad) EqualVT

func (this *Gamepad) EqualVT(that *Gamepad) bool

func (*Gamepad) GetHeld

func (x *Gamepad) GetHeld() []GamepadButton

func (*Gamepad) GetLeftTrigger

func (x *Gamepad) GetLeftTrigger() float32

func (*Gamepad) GetLeftX

func (x *Gamepad) GetLeftX() float32

func (*Gamepad) GetLeftY

func (x *Gamepad) GetLeftY() float32

func (*Gamepad) GetPressed

func (x *Gamepad) GetPressed() []GamepadButton

func (*Gamepad) GetReleased

func (x *Gamepad) GetReleased() []GamepadButton

func (*Gamepad) GetRightTrigger

func (x *Gamepad) GetRightTrigger() float32

func (*Gamepad) GetRightX

func (x *Gamepad) GetRightX() float32

func (*Gamepad) GetRightY

func (x *Gamepad) GetRightY() float32

func (*Gamepad) MarshalJSON

func (x *Gamepad) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Gamepad to JSON.

func (*Gamepad) MarshalProtoJSON

func (x *Gamepad) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the Gamepad message to JSON.

func (*Gamepad) MarshalProtoText

func (x *Gamepad) MarshalProtoText() string

func (*Gamepad) MarshalToSizedBufferVT

func (m *Gamepad) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Gamepad) MarshalToVT

func (m *Gamepad) MarshalToVT(dAtA []byte) (int, error)

func (*Gamepad) MarshalVT

func (m *Gamepad) MarshalVT() (dAtA []byte, err error)

func (*Gamepad) ProtoMessage

func (*Gamepad) ProtoMessage()

func (*Gamepad) Reset

func (x *Gamepad) Reset()

func (*Gamepad) SizeVT

func (m *Gamepad) SizeVT() (n int)

func (*Gamepad) String

func (x *Gamepad) String() string

func (*Gamepad) UnmarshalJSON

func (x *Gamepad) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Gamepad from JSON.

func (*Gamepad) UnmarshalProtoJSON

func (x *Gamepad) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the Gamepad message from JSON.

func (*Gamepad) UnmarshalVT

func (m *Gamepad) UnmarshalVT(dAtA []byte) error

type GamepadButton

type GamepadButton int32

GamepadButton names one button of the gamepad layout, by position as SDL names them: South is A on an Xbox controller and Cross on a PlayStation one.

const (
	// GAMEPAD_BUTTON_UNKNOWN is a button the layout does not name.
	GamepadButton_GAMEPAD_BUTTON_UNKNOWN GamepadButton = 0
	// GAMEPAD_BUTTON_SOUTH is the bottom face button.
	GamepadButton_GAMEPAD_BUTTON_SOUTH GamepadButton = 1
	// GAMEPAD_BUTTON_EAST is the right face button.
	GamepadButton_GAMEPAD_BUTTON_EAST GamepadButton = 2
	// GAMEPAD_BUTTON_WEST is the left face button.
	GamepadButton_GAMEPAD_BUTTON_WEST GamepadButton = 3
	// GAMEPAD_BUTTON_NORTH is the top face button.
	GamepadButton_GAMEPAD_BUTTON_NORTH GamepadButton = 4
	// GAMEPAD_BUTTON_BACK is the View, Select or Share button.
	GamepadButton_GAMEPAD_BUTTON_BACK GamepadButton = 5
	// GAMEPAD_BUTTON_GUIDE is the Xbox, PS or Home button.
	GamepadButton_GAMEPAD_BUTTON_GUIDE GamepadButton = 6
	// GAMEPAD_BUTTON_START is the Menu, Start or Options button.
	GamepadButton_GAMEPAD_BUTTON_START GamepadButton = 7
	// GAMEPAD_BUTTON_LEFT_STICK is the left stick pressed in.
	GamepadButton_GAMEPAD_BUTTON_LEFT_STICK GamepadButton = 8
	// GAMEPAD_BUTTON_RIGHT_STICK is the right stick pressed in.
	GamepadButton_GAMEPAD_BUTTON_RIGHT_STICK GamepadButton = 9
	// GAMEPAD_BUTTON_LEFT_SHOULDER is the left bumper.
	GamepadButton_GAMEPAD_BUTTON_LEFT_SHOULDER GamepadButton = 10
	// GAMEPAD_BUTTON_RIGHT_SHOULDER is the right bumper.
	GamepadButton_GAMEPAD_BUTTON_RIGHT_SHOULDER GamepadButton = 11
	// GAMEPAD_BUTTON_DPAD_UP is the directional pad's up.
	GamepadButton_GAMEPAD_BUTTON_DPAD_UP GamepadButton = 12
	// GAMEPAD_BUTTON_DPAD_DOWN is the directional pad's down.
	GamepadButton_GAMEPAD_BUTTON_DPAD_DOWN GamepadButton = 13
	// GAMEPAD_BUTTON_DPAD_LEFT is the directional pad's left.
	GamepadButton_GAMEPAD_BUTTON_DPAD_LEFT GamepadButton = 14
	// GAMEPAD_BUTTON_DPAD_RIGHT is the directional pad's right.
	GamepadButton_GAMEPAD_BUTTON_DPAD_RIGHT GamepadButton = 15
	// GAMEPAD_BUTTON_MISC is the extra button some pads have, such as the
	// Xbox Share button or the PlayStation microphone button.
	GamepadButton_GAMEPAD_BUTTON_MISC GamepadButton = 16
	// GAMEPAD_BUTTON_TOUCHPAD is the PlayStation touchpad pressed.
	GamepadButton_GAMEPAD_BUTTON_TOUCHPAD GamepadButton = 17
)

func (GamepadButton) Enum

func (x GamepadButton) Enum() *GamepadButton

func (GamepadButton) MarshalJSON

func (x GamepadButton) MarshalJSON() ([]byte, error)

MarshalJSON marshals the GamepadButton to JSON.

func (GamepadButton) MarshalProtoJSON

func (x GamepadButton) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the GamepadButton to JSON.

func (GamepadButton) MarshalProtoText

func (x GamepadButton) MarshalProtoText() string

func (GamepadButton) MarshalText

func (x GamepadButton) MarshalText() ([]byte, error)

MarshalText marshals the GamepadButton to text.

func (GamepadButton) String

func (x GamepadButton) String() string

func (*GamepadButton) UnmarshalJSON

func (x *GamepadButton) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the GamepadButton from JSON.

func (*GamepadButton) UnmarshalProtoJSON

func (x *GamepadButton) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the GamepadButton from JSON.

func (*GamepadButton) UnmarshalText

func (x *GamepadButton) UnmarshalText(b []byte) error

UnmarshalText unmarshals the GamepadButton from text.

type PlayerControllers

type PlayerControllers struct {

	// Player is the player's slot.
	Player int32 `protobuf:"varint,1,opt,name=player,proto3" json:"player,omitempty"`
	// Stream is the state of the stream that brings them.
	Stream ControllerStream `protobuf:"varint,2,opt,name=stream,proto3" json:"stream,omitempty"`
	// Controllers lists the player's devices, empty while Stream is none.
	Controllers []*Controller `protobuf:"bytes,3,rep,name=controllers,proto3" json:"controllers,omitempty"`
	// contains filtered or unexported fields
}

PlayerControllers is one watched player's controllers in a frame.

func (*PlayerControllers) CloneMessageVT

func (m *PlayerControllers) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*PlayerControllers) CloneVT

func (m *PlayerControllers) CloneVT() *PlayerControllers

func (*PlayerControllers) EqualMessageVT

func (this *PlayerControllers) EqualMessageVT(thatMsg any) bool

func (*PlayerControllers) EqualVT

func (this *PlayerControllers) EqualVT(that *PlayerControllers) bool

func (*PlayerControllers) GetControllers

func (x *PlayerControllers) GetControllers() []*Controller

func (*PlayerControllers) GetPlayer

func (x *PlayerControllers) GetPlayer() int32

func (*PlayerControllers) GetStream

func (x *PlayerControllers) GetStream() ControllerStream

func (*PlayerControllers) MarshalJSON

func (x *PlayerControllers) MarshalJSON() ([]byte, error)

MarshalJSON marshals the PlayerControllers to JSON.

func (*PlayerControllers) MarshalProtoJSON

func (x *PlayerControllers) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the PlayerControllers message to JSON.

func (*PlayerControllers) MarshalProtoText

func (x *PlayerControllers) MarshalProtoText() string

func (*PlayerControllers) MarshalToSizedBufferVT

func (m *PlayerControllers) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*PlayerControllers) MarshalToVT

func (m *PlayerControllers) MarshalToVT(dAtA []byte) (int, error)

func (*PlayerControllers) MarshalVT

func (m *PlayerControllers) MarshalVT() (dAtA []byte, err error)

func (*PlayerControllers) ProtoMessage

func (*PlayerControllers) ProtoMessage()

func (*PlayerControllers) Reset

func (x *PlayerControllers) Reset()

func (*PlayerControllers) SizeVT

func (m *PlayerControllers) SizeVT() (n int)

func (*PlayerControllers) String

func (x *PlayerControllers) String() string

func (*PlayerControllers) UnmarshalJSON

func (x *PlayerControllers) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the PlayerControllers from JSON.

func (*PlayerControllers) UnmarshalProtoJSON

func (x *PlayerControllers) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the PlayerControllers message from JSON.

func (*PlayerControllers) UnmarshalVT

func (m *PlayerControllers) UnmarshalVT(dAtA []byte) error

type WatchControllersRequest

type WatchControllersRequest struct {

	// Player is the player's slot.
	Player int32 `protobuf:"varint,1,opt,name=player,proto3" json:"player,omitempty"`
	// Watch is true to start watching and false to stop.
	Watch bool `protobuf:"varint,2,opt,name=watch,proto3" json:"watch,omitempty"`
	// contains filtered or unexported fields
}

WatchControllersRequest starts or stops a mod's watch of one player's controllers.

func (*WatchControllersRequest) CloneMessageVT

func (*WatchControllersRequest) CloneVT

func (*WatchControllersRequest) EqualMessageVT

func (this *WatchControllersRequest) EqualMessageVT(thatMsg any) bool

func (*WatchControllersRequest) EqualVT

func (*WatchControllersRequest) GetPlayer

func (x *WatchControllersRequest) GetPlayer() int32

func (*WatchControllersRequest) GetWatch

func (x *WatchControllersRequest) GetWatch() bool

func (*WatchControllersRequest) MarshalJSON

func (x *WatchControllersRequest) MarshalJSON() ([]byte, error)

MarshalJSON marshals the WatchControllersRequest to JSON.

func (*WatchControllersRequest) MarshalProtoJSON

func (x *WatchControllersRequest) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the WatchControllersRequest message to JSON.

func (*WatchControllersRequest) MarshalProtoText

func (x *WatchControllersRequest) MarshalProtoText() string

func (*WatchControllersRequest) MarshalToSizedBufferVT

func (m *WatchControllersRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*WatchControllersRequest) MarshalToVT

func (m *WatchControllersRequest) MarshalToVT(dAtA []byte) (int, error)

func (*WatchControllersRequest) MarshalVT

func (m *WatchControllersRequest) MarshalVT() (dAtA []byte, err error)

func (*WatchControllersRequest) ProtoMessage

func (*WatchControllersRequest) ProtoMessage()

func (*WatchControllersRequest) Reset

func (x *WatchControllersRequest) Reset()

func (*WatchControllersRequest) SizeVT

func (m *WatchControllersRequest) SizeVT() (n int)

func (*WatchControllersRequest) String

func (x *WatchControllersRequest) String() string

func (*WatchControllersRequest) UnmarshalJSON

func (x *WatchControllersRequest) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the WatchControllersRequest from JSON.

func (*WatchControllersRequest) UnmarshalProtoJSON

func (x *WatchControllersRequest) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the WatchControllersRequest message from JSON.

func (*WatchControllersRequest) UnmarshalVT

func (m *WatchControllersRequest) UnmarshalVT(dAtA []byte) error

Jump to

Keyboard shortcuts

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