ASW Lib
A.D.S. Games SDL Wrapper Library. A library targeted at Allegro4 users who want to switch to SDL3 and use modern c++.
Loading...
Searching...
No Matches
asw::game::GameObject Class Reference

Game Object. More...

#include <game.h>

Inheritance diagram for asw::game::GameObject:
[legend]
Collaboration diagram for asw::game::GameObject:
[legend]

Public Member Functions

 GameObject ()=default
 
virtual ~GameObject ()=default
 
virtual void update (float deltaTime)
 Update the object.
 
virtual void draw ()
 Draw the object to the screen.
 
const asw::Quad< float > & getTransform () const
 Get transform.
 

Public Attributes

asw::Quad< float > transform
 The transform of the object.
 
float rotation {0}
 The rotation of the object in degrees.
 
int zIndex {0}
 The layer that the object is on.
 
bool active {true}
 Whether or not the object is active.
 
float alpha {1.0F}
 Opacity of the object.
 
Physics body
 Physics body of the object.
 
bool alive {true}
 Alive state.
 

Detailed Description

Game Object.

Objects

Definition at line 37 of file game.h.

Constructor & Destructor Documentation

◆ GameObject()

asw::game::GameObject::GameObject ( )
default

◆ ~GameObject()

virtual asw::game::GameObject::~GameObject ( )
virtualdefault

Member Function Documentation

◆ draw()

virtual void asw::game::GameObject::draw ( )
inlinevirtual

Draw the object to the screen.

Reimplemented in asw::game::Sprite, and asw::game::Text.

Definition at line 56 of file game.h.

◆ getTransform()

const asw::Quad< float > & asw::game::GameObject::getTransform ( ) const
inline

Get transform.

Returns
The position of the object.

Definition at line 62 of file game.h.

◆ update()

virtual void asw::game::GameObject::update ( float deltaTime)
inlinevirtual

Update the object.

Parameters
deltaTimeThe time since the last update.

Reimplemented in asw::game::Sprite, and asw::game::Text.

Definition at line 47 of file game.h.

Member Data Documentation

◆ active

bool asw::game::GameObject::active {true}

Whether or not the object is active.

If an object is not active, it will not be updated or drawn.

Definition at line 81 of file game.h.

◆ alive

bool asw::game::GameObject::alive {true}

Alive state.

Definition at line 93 of file game.h.

◆ alpha

float asw::game::GameObject::alpha {1.0F}

Opacity of the object.

Definition at line 85 of file game.h.

◆ body

Physics asw::game::GameObject::body

Physics body of the object.

Definition at line 89 of file game.h.

◆ rotation

float asw::game::GameObject::rotation {0}

The rotation of the object in degrees.

Definition at line 70 of file game.h.

◆ transform

asw::Quad<float> asw::game::GameObject::transform

The transform of the object.

Definition at line 66 of file game.h.

◆ zIndex

int asw::game::GameObject::zIndex {0}

The layer that the object is on.

Objects on higher layers are drawn on top of objects on lower layers.

Definition at line 76 of file game.h.


The documentation for this class was generated from the following file: