Crate topaz [−] [src]
Topaz is a tiny game engine. It is based on the Entity-Component-System (ECS) model.
Each game object is an entity, which has certain components. Components define everything
about the entity. For example, one entity may have the Drawable
and Position
components,
while another also has the Solid
component.
Systems operate on the entities when certain events occur. For example, a Rendering
system
should operate on all entities with a Drawable
component every frame. In Topaz, systems are
'subscribed' to events, meaning the system runs when the event occurs. The EVENT_UPDATE
event
is automatically fired every frame, so the Rendering
system we just described would be subscribed
to EVENT_UPDATE
, thus causing the game objects to be drawn every frame.
For basic boilerplate code, check out the 'hello-world' example.
The Universe
struct contains much of the important documentation; look there first.
Structs
NullEntity |
A null entity. Use when no components are required. |
SimpleEvent |
A simple event with no metadata besides ID. |
Universe |
The Universe contains all the meta-data neccessary for the game engine. |
Constants
EVENT_INIT |
Triggered when the universe starts up. |
EVENT_QUIT |
Triggering this event causes the universe to shut down, and |
EVENT_UPDATE |
Triggered every frame while the universe is running. |
Traits
Event |
All events must implement this trait. |
HasComponents |
Entities must implement this trait. |
System |
All systems must implement this trait. |
Type Definitions
Component |
Convenience type for defining immutable entity component fields. |
MutComponent |
Convenience type for defining mutable entity component fields. |