The Blank Game
A Blank 2D Game with Sound and a Sprite
Loading...
Searching...
No Matches
CObject Class Reference

The game object. More...

#include <Object.h>

Inheritance diagram for CObject:
Collaboration diagram for CObject:

Public Member Functions

 CObject (eObject, eSprite, const Vector2 &)
 Constructor.
 
virtual ~CObject ()
 Destructor.
 
void Move ()
 Move object.
 
void Draw ()
 Draw object.
 

Protected Attributes

eObject m_eObject = eObject::Unknown
 Object type.
 
eSprite m_eSprite = eSprite::TextWheel
 Sprite type.
 
Vector2 m_vPos
 Position.
 
float m_fRoll = 0
 Roll angle.
 

Friends

class Sage::CObjectManager< CObject >
 Object manager has full access.
 

Additional Inherited Members

- Static Protected Attributes inherited from CCommon
static Sage::CSpriteRenderer * m_pRenderer = nullptr
 Pointer to the renderer.
 

Detailed Description

CObject is the abstract representation of a game object such as the player / character, non-player characters, and furniture. Objects will be / managed by an object managerSage::CObjectManager<CObject>, which is a / friend ofCObjectso that it can access any private members as needed to / manage the objects without the need for get and set functions for each / private or protected member variable. It is derived fromSage::CObject, / and therefore must contain public member functionsMove()andDraw()` to move and draw itself, respectively.

Constructor & Destructor Documentation

◆ CObject()

CObject::CObject ( eObject obj,
eSprite spr,
const Vector2 & p )

Create and initialize an object.

Parameters
objObject type.
sprSprite type.
pInitial position of object.

Member Function Documentation

◆ Draw()

void CObject::Draw ( )

Draw the sprite offset by the center offset.

◆ Move()

void CObject::Move ( )

Move object an amount that depends on the frame time.