The LARC Game Engine
A Simple Game Engine from the Laboratory for Recreational Computing
Public Member Functions | Protected Attributes | List of all members
LBaseObject Class Reference

The basic game object. More...

#include <BaseObject.h>

Inheritance diagram for LBaseObject:
LComponent LSpriteDesc2D LSpriteDesc

Public Member Functions

template<class t >
 LBaseObject (t, const Vector2 &)
 Constructor. More...
 
virtual void move ()
 Move object stub. More...
 
virtual void draw ()
 Draw object stub. More...
 
const bool IsReadyToDelete () const
 Is ready to be deleted from object list. More...
 
- Public Member Functions inherited from LSpriteDesc2D
 LSpriteDesc2D ()
 Constructor. More...
 
 LSpriteDesc2D (UINT, const Vector2 &)
 Constructor. More...
 
- Public Member Functions inherited from LSpriteDesc
 LSpriteDesc ()
 Constructor. More...
 
 LSpriteDesc (UINT)
 Constructor. More...
 

Protected Attributes

bool m_bDead = false
 Is ready to delete from object list.
 

Additional Inherited Members

- Public Attributes inherited from LSpriteDesc2D
Vector2 m_vPos = Vector2::Zero
 Position.
 
- Public Attributes inherited from LSpriteDesc
UINT m_nSpriteIndex = 0
 Sprite index.
 
UINT m_nCurrentFrame = 0
 Current animation frame.
 
float m_fXScale = 1.0f
 Horizontal scale.
 
float m_fYScale = 1.0f
 Vertical scale.
 
float m_fRoll = 0.0f
 Z-axis rotation.
 
XMFLOAT4 m_f4Tint = XMFLOAT4(1.0f, 1.0f, 1.0f, 1.0f)
 Color tint.
 
float m_fAlpha = 1.0f
 Alpha channel, 0.0f for transparent, 1.0f for opaque.
 
- Static Protected Attributes inherited from LComponent
static LTimerm_pTimer = &cTimer
 Pointer to a timer. More...
 
static LRandomm_pRandom = &cRandom
 Pointer to a PRNG. More...
 
static LKeyboardm_pKeyboard = &cKeyboard
 Pointer to a keyboard handler. More...
 
static LXBoxControllerm_pController = &cController
 Pointer to a XBox controller. More...
 
static LSoundm_pAudio = &cAudio
 Pointer to an audio player. More...
 

Detailed Description

LBaseObject is a basic object containing the necessary functions and data for managing the object list, plus virtual function stubs for moving and drawing during animation. You should derive the object classes in your game from this class. It is designed for use with an object manager derived from LBaseObjectManager. Simply set m_bDead to true when the object is dead so that it can be cleaned up and deleted from the object list automatically in the next frame.

Constructor & Destructor Documentation

◆ LBaseObject()

template<class t >
LBaseObject::LBaseObject ( e,
const Vector2 &  p 
)
Template Parameters
tSprite enumerated type.
Parameters
eSprite type.
pInitial position of object.

Member Function Documentation

◆ draw()

void LBaseObject::draw ( )
virtual

Draw object. This function is a stub and should never be executed. If the programmer neglects to override this function, then the game will abort.

◆ IsReadyToDelete()

const bool LBaseObject::IsReadyToDelete ( ) const

Reader function for the member variable m_bDead.

Returns
true if ready to be deleted from the object list.

◆ move()

void LBaseObject::move ( )
virtual

Move object. This function is a stub and should never be executed. If the programmer neglects to override this function, then the game will abort.