Collision Math Toy
Game Physics with Bespoke Code
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 (Shapes::CShape *, const CObjDesc &)
 Constructor.
 
const Shapes::CAabb2D & GetAABB () const
 Get AABB.
 
Shapes::CShape * GetShape () const
 Get pointer to shape.
 
const Shapes::eMotion GetMotionType () const
 Get motion type.
 

Private Attributes

eSprite m_eUnlitSprite = eSprite::None
 Unlit sprite.
 
eSprite m_eLitSprite = eSprite::None
 Unlit sprite.
 
Vector2 m_vSpriteOffset
 Sprite offset in local coordinates.
 
eSound m_eSound = eSound(0)
 Collision sound.
 
XMFLOAT4 m_f4Tint = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f)
 Color overlay.
 
Shapes::CShape * m_pShape = nullptr
 Pointer to shape.

 
bool m_bRecentHit = false
 Was hit recently.
 
float m_fLastHitTime = 0.0f
 Time of last hit.
 

Friends

class CObjectManager
 

Detailed Description

CObject is the abstract representation of an object. Notice that CObject has no move or draw functions. Moving and drawing is now handled by CShape.

Constructor & Destructor Documentation

◆ CObject()

CObject::CObject ( Shapes::CShape * p,
const CObjDesc & d )

Constructor.

Parameters
pPointer to a shape.
dPointer to an object descriptor.

Member Function Documentation

◆ GetAABB()

const Shapes::CAabb2D & CObject::GetAABB ( ) const

Reader function for the object's AABB. It gets this by querying the object's shape's AABB.

Returns
The object's AABB.

◆ GetMotionType()

const Shapes::eMotion CObject::GetMotionType ( ) const

Reader function for the object's motion type. It gets this by querying the object's shape's motion type.

Returns
The object's motion type.

◆ GetShape()

Shapes::CShape * CObject::GetShape ( ) const

Reader function for the object's shape.

Returns
A pointer to the object's shape.