Rubeus::RGameObject class

A game object. Main class responsible for player interactions.

Base classes

class RMasterComponent
A master component. Serves as parent class for all components.

Derived classes

class RGroup
A group of objects in a family based hierarchy.

Public static variables

static std::unordered_map<std::string, RGameObject*> InstantiatedGameObjects
The singular array that tracks all objects that were instantiated of this class.

Constructors, destructors, conversion operators

RGameObject(std::string name, std::string levelName, float x, float y, float deltaX, float deltaY, const char* imageFilePath, bool enablePhysics = false, const Awerere::EColliderType& type = Awerere::EColliderType::NO_COLLIDER, Awerere::ACollider* collider = NULL, bool generatesHit = false, const Awerere::APhysicsMaterial& physicsMat = Awerere::APhysicsMaterial())
Constructor. Uses images as textures.
RGameObject(std::string name, std::string levelName, float x, float y, float deltaX, float deltaY, float& r, float& g, float& b, bool enablePhysics = false, const Awerere::APhysicsMaterial& material = Awerere::APhysicsMaterial(), const Awerere::EColliderType& type = Awerere::EColliderType::NO_COLLIDER, Awerere::ACollider* collider = NULL, bool generatesHit = false)
Constructor. Uses pure colors as textures.
~RGameObject()
Destructor.
RGameObject() protected
Protected constructor. Only used to create groups.

Public functions

void begin() virtual
Called by the engine once before the level starts to run.
void tick() override virtual
Tick function.
void onHit(RGameObject* hammer, RGameObject* nail, const Awerere::ACollideData& collisionData) virtual
User defined function called whenever a hit event is generated.
void addToTickQueue()
Set this object for tick by update function.
void onMessage(Message* msg) override virtual
Handles message sent by Message system.

Public variables

std::string m_Name
Name of this game object.
std::string m_UsedByLevelName
The level context during which this object lives.
GraphicComponents::RSprite* m_Sprite
Sprite used for the rendering process.
Awerere::APhysicsObject* m_PhysicsObject
Physics object that handles collisions/response.
bool m_ThisTicks
Whether this gameobject ticks.
bool m_UsesTexture
Whether this gameobject uses a texture.
bool m_IsGroup
Whether this gameobject is a group of other child gameobjects.
bool m_HasPhysics
Whether this gameobject obeys physics and responds to collisions.
bool m_GeneratesHit
Whether this gameobject generates hit events.

Function documentation

Rubeus::RGameObject::RGameObject(std::string name, std::string levelName, float x, float y, float deltaX, float deltaY, const char* imageFilePath, bool enablePhysics = false, const Awerere::EColliderType& type = Awerere::EColliderType::NO_COLLIDER, Awerere::ACollider* collider = NULL, bool generatesHit = false, const Awerere::APhysicsMaterial& physicsMat = Awerere::APhysicsMaterial())

Constructor. Uses images as textures.

Parameters
name Name of this game object.
levelName Name of level that uses this object.
x x coordinate of the lower left point.
y y coordinate of the lower left point.
deltaX Horizontal span of the object.
deltaY Vertical span of the object.
imageFilePath Path to the image to be used as texture.
enablePhysics Whether the object obeys physics. Default is false.
type Collider type to be assigned to this gameobject. Defaults to NO_COLLIDER
collider The collider object to be used. Defaults to NULL.
generatesHit Whether the object generates hit events. Default is false.
physicsMat Provide a physics material to be used to respond to hit events. Defaults to DefaultPhysicsMat.

Rubeus::RGameObject::RGameObject(std::string name, std::string levelName, float x, float y, float deltaX, float deltaY, float& r, float& g, float& b, bool enablePhysics = false, const Awerere::APhysicsMaterial& material = Awerere::APhysicsMaterial(), const Awerere::EColliderType& type = Awerere::EColliderType::NO_COLLIDER, Awerere::ACollider* collider = NULL, bool generatesHit = false)

Constructor. Uses pure colors as textures.

Parameters
name Name of this game object.
levelName Name of level that uses this object.
x x coordinate of the lower left point.
y y coordinate of the lower left point.
deltaX Horizontal span of the object.
deltaY Vertical span of the object.
r Red channel value.
g Green channel value.
b Blue channel value
enablePhysics Whether the object obeys physics. Default is false.
material Provide a physics material to be used to respond to hit events. Defaults to DefaultPhysicsMat.
type Collider type to be assigned to this gameobject. Defaults to NO_COLLIDER.
collider The collider object to be used. Defaults to NULL.
generatesHit Whether the object generates hit events. Default is false.

void Rubeus::RGameObject::tick() override virtual

Tick function.

void Rubeus::RGameObject::onHit(RGameObject* hammer, RGameObject* nail, const Awerere::ACollideData& collisionData) virtual

User defined function called whenever a hit event is generated.

Parameters
hammer The hitting object.
nail The object getting hit
collisionData Details of the collision

void Rubeus::RGameObject::onMessage(Message* msg) override virtual

Handles message sent by Message system.

Parameters
msg The message data.