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 dt)
 Update the object.
 
virtual void draw ()
 Draw the object to the screen.
 
const asw::Quad< float > & get_transform () const
 Get transform.
 

Public Attributes

asw::Quad< float > transform
 The transform of the object.
 
float rotation { 0.0F }
 The rotation of the object in radians.
 
int z_index { 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 42 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, asw::game::Text, and asw::ParticleEmitter.

Definition at line 62 of file game.h.

◆ get_transform()

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

Get transform.

Returns
The position of the object.

Definition at line 70 of file game.h.

◆ update()

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

Update the object.

Parameters
dtThe time in seconds since the last update.

Reimplemented in asw::ParticleEmitter.

Definition at line 52 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 92 of file game.h.

◆ alive

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

Alive state.

Definition at line 104 of file game.h.

◆ alpha

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

Opacity of the object.

Definition at line 96 of file game.h.

◆ body

Physics asw::game::GameObject::body

Physics body of the object.

Definition at line 100 of file game.h.

◆ rotation

float asw::game::GameObject::rotation { 0.0F }

The rotation of the object in radians.

Definition at line 81 of file game.h.

◆ transform

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

The transform of the object.

Definition at line 77 of file game.h.

◆ z_index

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

The layer that the object is on.

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

Definition at line 87 of file game.h.


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