Documentation ¶
Index ¶
- func CheckDestroyType(registered_type, type_to_check Type) bool
- func CheckInitializeType(registered_type, type_to_check Type) bool
- func FinalizeRegistration()
- func IsValidType(t Type) bool
- func RegisterDestroyTypes(registered_type Type, collection_types ...Type)
- func RegisterInitializeTypes(registered_type Type, collection_types ...Type)
- func RegistrationFinalized() bool
- type Base
- type Collection
- type Component
- type Data
- type RegistrationList
- type Type
- type TypeSlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDestroyType ¶
func CheckInitializeType ¶
func FinalizeRegistration ¶
func FinalizeRegistration()
func IsValidType ¶
func RegisterDestroyTypes ¶
init_types enumerates all the types that will be available in Component.Destroy
func RegisterInitializeTypes ¶
init_types enumerates all the types that will be available in Component.Initialize
func RegistrationFinalized ¶
func RegistrationFinalized() bool
Types ¶
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
base is a useful class to embedded because it takes care of the Initialized and Destroyed for you
func (*Base) Destroy ¶
func (this *Base) Destroy(parent Collection)
Destroy finializes the destruction of a component. If a component does not call Component.Destroy() at the end of their overloaded Destroy() that component's Destroy will be called again next initialization loop
func (*Base) Initialize ¶
func (this *Base) Initialize(parent Collection)
Initialize finializes the initialization of a component. If a component does not call Component.Initialize() at the end of their overloaded Initialize() that component's Initialize will be called again next initialization loop
func (*Base) Initialized ¶
Initialized returns whether or not a component has called Initialize
type Collection ¶
type Collection interface {
GetComponent(requested_type Type) interface{}
}
Collections are basically "Game Objects". They are access controlled however, and will error if an invalid component is accessed. They may also provide a default "garbage" version of that component.
type Component ¶
type Component interface { LoadData(data Data) Initialize(parent Collection) Initialized() bool Destroy(parent Collection) Destroyed() bool GetType() Type }
The interface which components have to meet to be components
type Data ¶
type Data interface {
GetType() Type
}
Data types should be POD that can be serialized via GOB
func CreateData ¶
type RegistrationList ¶
type RegistrationList struct {
// contains filtered or unexported fields
}
func MakeRegistrationList ¶
func MakeRegistrationList(len, cap int) (r RegistrationList)
func (*RegistrationList) AddNewRegistrationID ¶
func (t *RegistrationList) AddNewRegistrationID() (id int)
func (*RegistrationList) Check ¶
func (t *RegistrationList) Check(id int, collection_type Type) bool
func (*RegistrationList) Register ¶
func (t *RegistrationList) Register(id int, collection_types ...Type)
func (*RegistrationList) RegistrationIDCount ¶
func (t *RegistrationList) RegistrationIDCount() int
returns the number of the RegistrationIDCount