simple

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Code generated by ecs https://github.com/gabstv/ecs; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPositionComponentFlag

func GetPositionComponentFlag(w ecs.World) ecs.Flag

GetPositionComponentFlag returns the flag of this component

func GetRotationComponentFlag

func GetRotationComponentFlag(w ecs.World) ecs.Flag

GetRotationComponentFlag returns the flag of this component

func GetVelocityComponentFlag

func GetVelocityComponentFlag(w ecs.World) ecs.Flag

GetVelocityComponentFlag returns the flag of this component

func SetPositionComponentData

func SetPositionComponentData(w ecs.World, e ecs.Entity, data Position)

SetPositionComponentData updates/adds a Position to Entity e

func SetRotationComponentData

func SetRotationComponentData(w ecs.World, e ecs.Entity, data Rotation)

SetRotationComponentData updates/adds a Rotation to Entity e

func SetVelocityComponentData

func SetVelocityComponentData(w ecs.World, e ecs.Entity, data Velocity)

SetVelocityComponentData updates/adds a Velocity to Entity e

Types

type MovementSystem

type MovementSystem struct {
	ecs.BaseSystem
	// contains filtered or unexported fields
}

MovementSystem implements ecs.System

func GetMovementSystem

func GetMovementSystem(w ecs.World) *MovementSystem

GetMovementSystem returns the instance of the system in a World

func (*MovementSystem) ComponentAdded

func (s *MovementSystem) ComponentAdded(e ecs.Entity, eflag ecs.Flag)

func (*MovementSystem) ComponentRemoved

func (s *MovementSystem) ComponentRemoved(e ecs.Entity, eflag ecs.Flag)

func (*MovementSystem) ComponentResized

func (s *MovementSystem) ComponentResized(cflag ecs.Flag)

func (*MovementSystem) ComponentWillResize

func (s *MovementSystem) ComponentWillResize(cflag ecs.Flag)

func (MovementSystem) Name

func (MovementSystem) Name() string

Name implements ecs.System

func (*MovementSystem) Priority

func (s *MovementSystem) Priority() int64

func (*MovementSystem) Setup

func (s *MovementSystem) Setup(w ecs.World)

func (MovementSystem) UUID

func (MovementSystem) UUID() string

UUID implements ecs.System

func (*MovementSystem) Update

func (s *MovementSystem) Update(dt float64)

Update MovementSystem matches

ecs:system uuid:E7D2FB64-2E98-4A14-8DE6-F088DE2AC3FB name:MovementSystem components: Position, Rotation, Velocity

member: lastdt float64

entityadded: onEntityAdded entityremoved: onEntityRemoved componentwillresize: onComponentWillResize componentresized: onComponentResized setup: onSetup

func (*MovementSystem) V

func (s *MovementSystem) V() *viewMovementSystem

func (*MovementSystem) View

func (s *MovementSystem) View() *viewMovementSystem

type Position

type Position struct {
	X float64
	Y float64
}

Position component

ecs:component uuid:3DF7F486-807D-4CE8-A187-37CED338137B

func GetPositionComponentData

func GetPositionComponentData(w ecs.World, e ecs.Entity) *Position

GetPositionComponentData returns the data of the component in a World

type PositionComponent

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

PositionComponent handles the component logic of the Position. Implements ecs.Component

func GetPositionComponent

func GetPositionComponent(w ecs.World) *PositionComponent

GetPositionComponent returns the instance of the component in a World

func (*PositionComponent) Data

func (c *PositionComponent) Data(e ecs.Entity) *Position

Data retrieves the *Position of entity e. Warning: volatile pointer (do not store)

func (*PositionComponent) Flag

func (c *PositionComponent) Flag() ecs.Flag

Flag returns the flag of this component

func (PositionComponent) Name

func (PositionComponent) Name() string

Name implements ecs.Component

func (*PositionComponent) Remove

func (c *PositionComponent) Remove(e ecs.Entity) bool

Remove a Position data from entity e Returns false if the component was not present in Entity e

func (*PositionComponent) Setup

func (c *PositionComponent) Setup(w ecs.World, f ecs.Flag, key [4]byte)

Setup is called by ecs.World Do not call this by yourself

func (PositionComponent) UUID

func (PositionComponent) UUID() string

UUID implements ecs.Component

func (*PositionComponent) Upsert

func (c *PositionComponent) Upsert(e ecs.Entity, data interface{}) (added bool)

Upsert creates or updates a component data of an entity. Not recommended to be used directly. Use SetPositionComponentData to change component data outside of a system loop.

func (*PositionComponent) World

func (c *PositionComponent) World() ecs.World

World implements ecs.Component

type PositionComponentObserver

type PositionComponentObserver interface {
	Entity() ecs.Entity
	Data() *Position
}

PositionComponentObserver is a helper struct to access a valid pointer of Position

func WatchPositionComponentData

func WatchPositionComponentData(w ecs.World, e ecs.Entity) PositionComponentObserver

WatchPositionComponentData gets a pointer getter of an entity's Position. The pointer must not be stored because it may become invalid over time.

type Rotation

type Rotation struct {
	Radians float64
}

Rotation component

ecs:component uuid:55AFAC07-F446-4DBE-B963-413B0C38E72B

func GetRotationComponentData

func GetRotationComponentData(w ecs.World, e ecs.Entity) *Rotation

GetRotationComponentData returns the data of the component in a World

type RotationComponent

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

RotationComponent handles the component logic of the Rotation. Implements ecs.Component

func GetRotationComponent

func GetRotationComponent(w ecs.World) *RotationComponent

GetRotationComponent returns the instance of the component in a World

func (*RotationComponent) Data

func (c *RotationComponent) Data(e ecs.Entity) *Rotation

Data retrieves the *Rotation of entity e. Warning: volatile pointer (do not store)

func (*RotationComponent) Flag

func (c *RotationComponent) Flag() ecs.Flag

Flag returns the flag of this component

func (RotationComponent) Name

func (RotationComponent) Name() string

Name implements ecs.Component

func (*RotationComponent) Remove

func (c *RotationComponent) Remove(e ecs.Entity) bool

Remove a Rotation data from entity e Returns false if the component was not present in Entity e

func (*RotationComponent) Setup

func (c *RotationComponent) Setup(w ecs.World, f ecs.Flag, key [4]byte)

Setup is called by ecs.World Do not call this by yourself

func (RotationComponent) UUID

func (RotationComponent) UUID() string

UUID implements ecs.Component

func (*RotationComponent) Upsert

func (c *RotationComponent) Upsert(e ecs.Entity, data interface{}) (added bool)

Upsert creates or updates a component data of an entity. Not recommended to be used directly. Use SetRotationComponentData to change component data outside of a system loop.

func (*RotationComponent) World

func (c *RotationComponent) World() ecs.World

World implements ecs.Component

type RotationComponentObserver

type RotationComponentObserver interface {
	Entity() ecs.Entity
	Data() *Rotation
}

RotationComponentObserver is a helper struct to access a valid pointer of Rotation

func WatchRotationComponentData

func WatchRotationComponentData(w ecs.World, e ecs.Entity) RotationComponentObserver

WatchRotationComponentData gets a pointer getter of an entity's Rotation. The pointer must not be stored because it may become invalid over time.

type System

type System interface {
	ecs.System
	Update(dt float64)
}

type VIMovementSystem

type VIMovementSystem struct {
	Entity   ecs.Entity
	Position *Position
	Rotation *Rotation
	Velocity *Velocity
}

type Velocity

type Velocity struct {
	X       float64
	Y       float64
	Radians float64
}

Velocity component

ecs:component the uuid for this component is generated automatically

func GetVelocityComponentData

func GetVelocityComponentData(w ecs.World, e ecs.Entity) *Velocity

GetVelocityComponentData returns the data of the component in a World

type VelocityComponent

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

VelocityComponent handles the component logic of the Velocity. Implements ecs.Component

func GetVelocityComponent

func GetVelocityComponent(w ecs.World) *VelocityComponent

GetVelocityComponent returns the instance of the component in a World

func (*VelocityComponent) Data

func (c *VelocityComponent) Data(e ecs.Entity) *Velocity

Data retrieves the *Velocity of entity e. Warning: volatile pointer (do not store)

func (*VelocityComponent) Flag

func (c *VelocityComponent) Flag() ecs.Flag

Flag returns the flag of this component

func (VelocityComponent) Name

func (VelocityComponent) Name() string

Name implements ecs.Component

func (*VelocityComponent) Remove

func (c *VelocityComponent) Remove(e ecs.Entity) bool

Remove a Velocity data from entity e Returns false if the component was not present in Entity e

func (*VelocityComponent) Setup

func (c *VelocityComponent) Setup(w ecs.World, f ecs.Flag, key [4]byte)

Setup is called by ecs.World Do not call this by yourself

func (VelocityComponent) UUID

func (VelocityComponent) UUID() string

UUID implements ecs.Component

func (*VelocityComponent) Upsert

func (c *VelocityComponent) Upsert(e ecs.Entity, data interface{}) (added bool)

Upsert creates or updates a component data of an entity. Not recommended to be used directly. Use SetVelocityComponentData to change component data outside of a system loop.

func (*VelocityComponent) World

func (c *VelocityComponent) World() ecs.World

World implements ecs.Component

type VelocityComponentObserver

type VelocityComponentObserver interface {
	Entity() ecs.Entity
	Data() *Velocity
}

VelocityComponentObserver is a helper struct to access a valid pointer of Velocity

func WatchVelocityComponentData

func WatchVelocityComponentData(w ecs.World, e ecs.Entity) VelocityComponentObserver

WatchVelocityComponentData gets a pointer getter of an entity's Velocity. The pointer must not be stored because it may become invalid over time.

type World

type World struct {
	ecs.World
}

func NewWorld

func NewWorld() *World

func (*World) Update

func (w *World) Update(dt float64)

Jump to

Keyboard shortcuts

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