ecs

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Copyright (c) 2021 Vladislav Fedotov (Falldot) License: MIT License MIT License web page: https://opensource.org/licenses/MIT

Copyright (c) 2021 Vladislav Fedotov (Falldot) License: MIT License MIT License web page: https://opensource.org/licenses/MIT

Copyright (c) 2021 Vladislav Fedotov (Falldot) License: MIT License MIT License web page: https://opensource.org/licenses/MIT

Copyright (c) 2021 Vladislav Fedotov (Falldot) License: MIT License MIT License web page: https://opensource.org/licenses/MIT

Copyright (c) 2021 Vladislav Fedotov (Falldot) License: MIT License MIT License web page: https://opensource.org/licenses/MIT

Copyright (c) 2021 Vladislav Fedotov (Falldot) License: MIT License MIT License web page: https://opensource.org/licenses/MIT

Copyright (c) 2021 Vladislav Fedotov (Falldot) License: MIT License MIT License web page: https://opensource.org/licenses/MIT

Copyright (c) 2021 Vladislav Fedotov (Falldot) License: MIT License MIT License web page: https://opensource.org/licenses/MIT

Copyright (c) 2021 Vladislav Fedotov (Falldot) License: MIT License MIT License web page: https://opensource.org/licenses/MIT

Copyright (c) 2021 Vladislav Fedotov (Falldot) License: MIT License MIT License web page: https://opensource.org/licenses/MIT

Copyright (c) 2021 Vladislav Fedotov (Falldot) License: MIT License MIT License web page: https://opensource.org/licenses/MIT

Copyright (c) 2021 Vladislav Fedotov (Falldot) License: MIT License MIT License web page: https://opensource.org/licenses/MIT

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cleaner

type Cleaner interface {
	Cleaner()
}

type Collector

type Collector interface {
	Entities() []*Entity

	OnAdd() Collector
	//OnRemove() Collector
	OnUpdate() Collector

	Clear()
}

type Component

type Component interface{}

type Contexts

type Contexts []interface{}

func SetContexts

func SetContexts(ebs ...interface{}) Contexts

func (*Contexts) Add

func (c *Contexts) Add(element interface{})

func (*Contexts) Get

func (c *Contexts) Get(id int) interface{}

type Entity

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

func (*Entity) Add

func (e *Entity) Add(tp int, component Component)

func (*Entity) Any

func (e *Entity) Any(tp ...int) bool

func (*Entity) Create

func (e *Entity) Create(tp int) (Component, bool)

func (*Entity) Destroy

func (e *Entity) Destroy()

func (*Entity) Get

func (e *Entity) Get(tp int) Component

func (*Entity) Has

func (e *Entity) Has(tp ...int) bool

func (*Entity) ID

func (e *Entity) ID() int

func (*Entity) Off

func (e *Entity) Off(tp int)

func (*Entity) On

func (e *Entity) On(tp int)

func (*Entity) OnComponentAdd

func (e *Entity) OnComponentAdd(action func(*Entity, int, Component))

func (*Entity) OnComponentOff

func (e *Entity) OnComponentOff(action func(*Entity, int, Component))

func (*Entity) OnComponentRemoved

func (e *Entity) OnComponentRemoved(action func(*Entity, int, Component))

func (*Entity) OnComponentReplaced

func (e *Entity) OnComponentReplaced(action func(*Entity, int, Component))

func (*Entity) OnEntityDestroy

func (e *Entity) OnEntityDestroy(action func(*Entity))

func (*Entity) OnEntityReleased

func (e *Entity) OnEntityReleased(action func(*Entity))

func (*Entity) Remove

func (e *Entity) Remove(tp int)

func (*Entity) Replace

func (e *Entity) Replace(tp int, component Component)

type EntityBase

type EntityBase interface {
	CreateEntity() *Entity
	Group(Matcher) Group
	Collector(Matcher) Collector

	OnGroupCreated(func(Group))

	OnEntityCreated(func(*Entity))
	OnEntityWillBeDestroyed(func(*Entity))
	OnEntityDestroyed(func(*Entity))
	// contains filtered or unexported methods
}

func CreateEntityBase

func CreateEntityBase(componentTotal int) EntityBase

type Executer

type Executer interface {
	Executer()
}

type Exiter

type Exiter interface {
	Exiter(Contexts)
}

type Group

type Group interface {
	Lenght() int
	GetEntities() []*Entity

	OnEntityAdded(func(Group, *Entity, int, Component))
	OnEntityRemoved(func(Group, *Entity, int, Component))
	OnEntityUpdate(func(Group, *Entity, int, Component))
	// contains filtered or unexported methods
}

type Initer

type Initer interface {
	Initer(Contexts)
}

type Matcher

type Matcher interface {

	/////////////////////////////////////////////////////
	//Public:
	AllOf(indices ...int) Matcher
	AnyOf(indices ...int) Matcher
	NoneOf(indices ...int) Matcher
	// contains filtered or unexported methods
}

func NewMatcher

func NewMatcher() Matcher

type Reactive

type Reactive interface {
	Trigger(contexts Contexts) Collector
	Filter(entity *Entity) bool
	Executer(entities []*Entity)
}

type Systems

type Systems interface {
	Init(contexts Contexts)
	Execute()
	Clean()
	Exit(contexts Contexts)

	Add(action interface{})
}

func CreateSystemPool

func CreateSystemPool() Systems

Jump to

Keyboard shortcuts

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