Documentation
¶
Index ¶
- func Abort(caught error)
- func EnableRendering(world World) *system.Rendering
- func EnableScripting(world World) (*system.Scripting, *lua.LState)
- func Lerp(a, b, distance float32) float32
- func RandomFloat32(min, max int) float32
- func RandomInt(min, max int) int
- func RandomInt32(min, max int) int32
- func Spawn(world World, obj, tex string, x, y, z, scale float32) entity.Entity
- func Storage() *bolt.DB
- type Configuration
- type DatabaseConfiguration
- type Library
- type WindowConfiguration
- type World
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Abort ¶
func Abort(caught error)
Abort handles an error by checking for a nil value and panicing otherwise.
func EnableRendering ¶
func Lerp ¶
Lerp is a linear interpolation implementation from many shader languages. Used to find a given distance between two known locations (coordinates).
The formula used here is taken from the Wikipedia article on the subject: https://en.wikipedia.org/wiki/Linear_interpolation#Programming_language_support
func RandomFloat32 ¶
func RandomInt32 ¶
Types ¶
type Configuration ¶
type Configuration struct {
Database DatabaseConfiguration
FPS int32
Window WindowConfiguration
}
func Config ¶
func Config() *Configuration
type DatabaseConfiguration ¶
type DatabaseConfiguration struct {
DSN string
}
type WindowConfiguration ¶
type World ¶
type World interface {
Update(name string, dt float32)
System(name string) system.System
// Component will return a component interface for the given entity and
// component name. The caller will have to use type assertions to extract
// the real value from the result.
Component(entity entity.Entity, name string) component.Component
// Entity will return the signature for the given entity ID.
Entity(entity entity.Entity) *bitset.BitSet
// Entities is a total count of entities living in the current world space.
Entities() int
// Destroy will remove the entity and all of it's dedicated component/system
// resources from the world, freeing up room for another (new) entity.
Destroy(entity entity.Entity)
// RegisterComponent will reserve a new component ID with the given name.
RegisterComponent(name string)
// RegisterComponent will reserve a new component ID with the given name.
RegisterSystem(system system.System, components ...string)
// CreateEntity will add a new living entity to the world and return it.
CreateEntity() entity.Entity
// SignEntity will set the given entity's signature for the given component names.
SignEntity(entity entity.Entity, components ...string)
// AttachComponent will assign the given component name and data to the entity.
AttachComponent(entity entity.Entity, component component.Component)
}
World instances act as coordinators between the entity, component, and system managers.
func CreateWorld ¶
func CreateWorld() World
CreateWorld returns a pointer to an empty world in memory.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.