control

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AxisVertical   string = "vertical"
	AxisHorizontal string = "horiztonal"
)

Axes for control input.

View Source
const (
	ButtonUp     string = "up"
	ButtonDown   string = "down"
	ButtonLeft   string = "left"
	ButtonRight  string = "right"
	ButtonSprint string = "sprint"
)

Buttons for control input.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControlComponent

type ControlComponent struct {
	Vertical, Horizontal string
	Enabled              bool
}

ControlComponent stores control input for player entity.

func (*ControlComponent) GetControlComponent

func (c *ControlComponent) GetControlComponent() *ControlComponent

GetControlComponent provides type safe access to ControlComponent.

type ControlFace

type ControlFace interface {
	GetControlComponent() *ControlComponent
}

ControlFace enforces type safe access to the underlying ControlComponent.

type ControlSystem

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

ControlSystem handles player input.

func (*ControlSystem) Add

func (cs *ControlSystem) Add(
	b *ecs.BasicEntity,
	c *ControlComponent,
)

Add an entity to the ControlSystem.

func (*ControlSystem) AddByInterface

func (cs *ControlSystem) AddByInterface(i ecs.Identifier)

AddByInterface adds entities to the system via Controlable interface.

func (*ControlSystem) New

func (cs *ControlSystem) New(*ecs.World)

New initialises ControlSystem when it's added to the world.

func (*ControlSystem) Remove

func (cs *ControlSystem) Remove(b ecs.BasicEntity)

Remove an entity from the ControlSystem.

func (*ControlSystem) Update

func (cs *ControlSystem) Update(dt float32)

Update the ControlSystem this frame.

type Controlable

type Controlable interface {
	ecs.BasicFace
	ControlFace
}

Controlable defines requirements for adding entities to the ControlSystem automatically.

Jump to

Keyboard shortcuts

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