component

package
v0.0.0-...-a6bf7df Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const MaxComponents = 10

MaxComponents is the total amount of components that each entity is allowed to have.

Variables

This section is empty.

Functions

This section is empty.

Types

type Acceleration

type Acceleration struct {
	ray.Vector3
}

Acceleration describes an entity's rate at which it increases it's velocity.

func (Acceleration) Name

func (Acceleration) Name() string

type Colour

type Colour struct {
	Red, Green, Blue byte
}

Colour represents a set of bytes to show colour on a display in an RGB format.

func (Colour) Name

func (Colour) Name() string

type Component

type Component interface {
	Name() string
}

Component is a generic struct with data in them for systems to utilize.

type ComponentManager

type ComponentManager interface {
	// Register will reserve a new ID by the given name for a component.
	Register(name string)

	// Read will return the component data by name for the given entity.
	Read(entity entity.Entity, name string) Component

	// Remove will delete the given component by name on the given entity.
	Remove(entity entity.Entity, name string)

	// Attach will assign a component data by name to the given entity.
	Attach(entity entity.Entity, name string, component Component)

	// Sign will create a signature for the given components by name that can be
	// assigned to an entity.
	Sign(names ...string) *bitset.BitSet

	// Signature will return the ID of a component by name.
	Signature(name string) int

	Destroy(entity entity.Entity)
}

ComponentManager takes care of creating, deleting, reading, and signing components to entities.

func CreateComponentManager

func CreateComponentManager() ComponentManager

CreateComponentManager will new up an empty manager with no components or signatures registered.

type Dimensions

type Dimensions struct {
	Width, Height, Radius float32
}

Dimensions is a representation of the 2D geomtry that makes up an object in the game world.

func (Dimensions) Name

func (Dimensions) Name() string

type Gravity

type Gravity struct {
	Force ray.Vector3
}

Gravity represents the amount of gravitational force the entity is under.

func (Gravity) Name

func (Gravity) Name() string

type Model

type Model struct {
	Loaded ray.Model
	Scale  float32
}

func (Model) Name

func (Model) Name() string

type Position

type Position struct {
	ray.Vector3
	Scale float32
}

func (Position) Name

func (Position) Name() string

type RigidBody

type RigidBody struct {
	Acceleration
	Velocity ray.Vector3
}

RigidBody is an entity with a solid body in which deformation is zero or so small it can be neglected. The distance between any two given points on a rigid body remains constant in time regardless of external forces exerted on it.

func (RigidBody) Name

func (RigidBody) Name() string

type Rotation

type Rotation struct {
	X, Y, Z int32
}

Rotation describes an entity's angle transformation.

func (Rotation) Name

func (Rotation) Name() string

type Scriptable

type Scriptable struct {
	Script *lua.LState
}

func (Scriptable) Name

func (Scriptable) Name() string

type Texture

type Texture struct {
	Loaded ray.Texture2D
}

func (Texture) Name

func (Texture) Name() string

type Transform

type Transform struct {
	Position
	Rotation
	Dimensions
	Scale float32
}

Transform describes an entity which has a position, rotation, and scale.

func (Transform) Name

func (Transform) Name() string

Jump to

Keyboard shortcuts

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