Documentation
¶
Index ¶
Constants ¶
View Source
const ( FlagNew = 1 << iota FlagNoCollide FlagRemoved FlagUserDefined )
Variables ¶
This section is empty.
Functions ¶
func NewIdGenerator ¶
func NewIdGenerator() func() Id
Returns a function to generate consecutive entity Id's that is safe to call concurrently.
Types ¶
type Entity ¶
type Entity interface { // Unique ID Id() Id // Location in the world Cell() coord.Cell // Returns a bounding object incorporating // the entities potential interaction with // the other entities in the world. Bounds() coord.Bounds // Returns the set of entity flags that can // set whether something collides or whether // an entity has been changed or not. Flags() Flag // Returns a state value that represents // the entity in its current state. ToState() State }
A basic entity in the world.
type RemovedState ¶
func (RemovedState) Bounds ¶
func (e RemovedState) Bounds() coord.Bounds
func (RemovedState) EntityId ¶
func (e RemovedState) EntityId() Id
func (RemovedState) IsDifferentFrom ¶
func (e RemovedState) IsDifferentFrom(other State) bool
type State ¶
type State interface { // Unique ID EntityId() Id // Bounds of the entity Bounds() coord.Bounds // Compare to another entity IsDifferentFrom(State) bool }
Used by the world state to calculate differences between world states. An object that implements this interface should also be friendly to the Json marshaller and expect to be sent to the client over the wire.
type StateSlice ¶
type StateSlice []State
func (StateSlice) FilterByBounds ¶
func (s StateSlice) FilterByBounds(result StateSlice, bounds coord.Bounds) StateSlice
Click to show internal directories.
Click to hide internal directories.