ecs

package
v0.0.0-...-a793aa1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveControlComponentData

type ActiveControlComponentData struct {
}

type ActiveControlSystem

type ActiveControlSystem struct {
	*CommonSystemData
	Keyboard *input.Keyboard
}

func NewActiveControlSystem

func NewActiveControlSystem(e *ECSManager, k *input.Keyboard) *ActiveControlSystem

func (*ActiveControlSystem) Run

func (sys *ActiveControlSystem) Run(delta float64, statemachine *statemachine.StateMachine)

func (*ActiveControlSystem) UpdateComponent

func (sys *ActiveControlSystem) UpdateComponent(delta float64, essentialData ...interface{})

type AnimateComponentData

type AnimateComponentData struct {
	// The string key is the animation's name such as "Idle", "Walk" etc...
	AnimationData *map[string]*AnimationComponentDataCore
	LastAnimation string
}

type AnimateSystem

type AnimateSystem struct {
	*CommonSystemData
}

func NewAnimateSystem

func NewAnimateSystem(e *ECSManager) *AnimateSystem

func (*AnimateSystem) Run

func (sys *AnimateSystem) Run(delta float64, statemachine *statemachine.StateMachine)

func (*AnimateSystem) UpdateComponent

func (sys *AnimateSystem) UpdateComponent(delta float64, essentialData ...interface{})

type AnimationComponentDataCore

type AnimationComponentDataCore struct {
	NumberAnimations         uint8
	DefaultAnimationDuration uint8
	CurrentFrame             uint8
	Paths                    []string
	Images                   []*sdl.Surface
	Textures                 []*sdl.Texture
}

type CollideSystem

type CollideSystem struct {
	*CommonSystemData
}

func NewCollideSystem

func NewCollideSystem(e *ECSManager) *CollideSystem

func (*CollideSystem) Run

func (sys *CollideSystem) Run(delta float64, statemachine *statemachine.StateMachine)

func (*CollideSystem) UpdateComponent

func (sys *CollideSystem) UpdateComponent(delta float64, essentialData ...interface{})

type CollisionComponentData

type CollisionComponentData struct {
	*CollisionCoreData
}

type CollisionCoreData

type CollisionCoreData struct {
	CollisionDirection     map[string]bool
	LastCollisionDirection map[string]bool
	IntersectRect          *sdl.Rect
	EntityCollidingWith    uint64
}

type CommonSystemData

type CommonSystemData struct {
	SystemID   uint16
	ECSManager *ECSManager
}

func NewCommonSystemData

func NewCommonSystemData(componentName string, ecsManager *ECSManager) *CommonSystemData

func (*CommonSystemData) GetComponentData

func (bs *CommonSystemData) GetComponentData(entityID uint64) interface{}

type ComponentData

type ComponentData struct {
	Data interface{}
}

type ECSManager

type ECSManager struct {
	EntityToComponentMap                    *orderedmap.OrderedMap
	EntityComponentStringToComponentDataMap map[string]*ComponentData
	ComponentIDStorage                      map[string]uint16
	ComponentData                           *ComponentData
	Systems                                 []System
}

func NewECSManager

func NewECSManager() *ECSManager

func (*ECSManager) AddComponentToEntity

func (e *ECSManager) AddComponentToEntity(entityID uint64, componentID uint16)

func (*ECSManager) GetComponentDataByID

func (e *ECSManager) GetComponentDataByID(entityID uint64, componentID uint16) interface{}

func (*ECSManager) GetComponentDataByName

func (e *ECSManager) GetComponentDataByName(entityID uint64, componentName string) interface{}

func (*ECSManager) GetComponentID

func (e *ECSManager) GetComponentID(componentName string) uint16

func (*ECSManager) GetComponentIDAsStr

func (e *ECSManager) GetComponentIDAsStr(componentName string) string

func (*ECSManager) GetEntityComponentKey

func (e *ECSManager) GetEntityComponentKey(entityID uint64, componentName string) string

func (*ECSManager) GetEntityIDBoundariesFromEntityRange

func (e *ECSManager) GetEntityIDBoundariesFromEntityRange(entityIDStr string) *[2]uint64

func (*ECSManager) GetEntityRect

func (e *ECSManager) GetEntityRect(entityID uint64) *sdl.Rect

func (*ECSManager) HasComponent

func (e *ECSManager) HasComponent(components []uint16, componentID uint16) bool

func (*ECSManager) HasNamedComponent

func (e *ECSManager) HasNamedComponent(components []uint16, componentName string) bool

func (*ECSManager) InitializeComponentsForEntity

func (e *ECSManager) InitializeComponentsForEntity(entityID uint64)

func (*ECSManager) LinkComponentsWithProperDataStruct

func (e *ECSManager) LinkComponentsWithProperDataStruct()

type GravityComponentData

type GravityComponentData struct{}

type GravitySystem

type GravitySystem struct {
	*CommonSystemData
}

func NewGravitySystem

func NewGravitySystem(e *ECSManager) *GravitySystem

func (*GravitySystem) Run

func (sys *GravitySystem) Run(delta float64, statemachine *statemachine.StateMachine)

func (*GravitySystem) UpdateComponent

func (sys *GravitySystem) UpdateComponent(delta float64, essentialData ...interface{})

type RenderComponentData

type RenderComponentData struct {
	Path     string
	Image    *sdl.Surface
	Texture  *sdl.Texture
	Text     *sdl.Surface
	FontSize uint8
}

type RenderSystem

type RenderSystem struct {
	*CommonSystemData
	Renderer *sdl.Renderer
	// contains filtered or unexported fields
}

func NewRenderSystem

func NewRenderSystem(e *ECSManager, renderer *sdl.Renderer) *RenderSystem

func (*RenderSystem) Run

func (sys *RenderSystem) Run(delta float64, statemachine *statemachine.StateMachine)

func (*RenderSystem) UpdateComponent

func (sys *RenderSystem) UpdateComponent(delta float64, essentialData ...interface{})

type SideScrollComponentData

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

type SideScrollSystem

type SideScrollSystem struct {
	*CommonSystemData
}

func NewSideScrollSystem

func NewSideScrollSystem(e *ECSManager) *SideScrollSystem

func (*SideScrollSystem) Run

func (sys *SideScrollSystem) Run(delta float64, statemachine *statemachine.StateMachine)

func (*SideScrollSystem) UpdateComponent

func (sys *SideScrollSystem) UpdateComponent(delta float64, essentialData ...interface{})

type System

type System interface {
	Run(delta float64, statemachine *statemachine.StateMachine)
	UpdateComponent(float64, ...interface{})
}

type TransformComponentData

type TransformComponentData struct {
	LastPosX    int32
	LastPosY    int32
	LastSpeed   int32
	PosX        int32
	PosY        int32
	DX          int32
	DY          int32
	FlipImg     bool
	Hspeed      int32
	Vspeed      int32
	IsJumping   bool
	IsNotMoving bool
}

type TransformSystem

type TransformSystem struct {
	*CommonSystemData
}

func NewTransformSystem

func NewTransformSystem(e *ECSManager) *TransformSystem

func (*TransformSystem) Run

func (sys *TransformSystem) Run(delta float64, statemachine *statemachine.StateMachine)

func (*TransformSystem) UpdateComponent

func (sys *TransformSystem) UpdateComponent(delta float64, essentialData ...interface{})

Jump to

Keyboard shortcuts

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