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::Sprite Class Reference

Sprite Object. More...

#include <game.h>

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

Public Member Functions

void setTexture (const asw::Texture &texture, bool autoSize=true)
 Set the texture of the sprite.
 
void update (float deltaTime) override
 Update the sprite.
 
void draw () override
 Draw the sprite to the screen.
 
- Public Member Functions inherited from asw::game::GameObject
 GameObject ()=default
 
virtual ~GameObject ()=default
 
const asw::Quad< float > & getTransform () const
 Get transform.
 

Private Attributes

asw::Texture texture
 The texture of the sprite.
 

Additional Inherited Members

- Public Attributes inherited from asw::game::GameObject
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

Sprite Object.

Definition at line 98 of file game.h.

Member Function Documentation

◆ draw()

void asw::game::Sprite::draw ( )
inlineoverridevirtual

Draw the sprite to the screen.

If a rotation is set, the sprite will be rotated around its center.

Reimplemented from asw::game::GameObject.

Definition at line 124 of file game.h.

◆ setTexture()

void asw::game::Sprite::setTexture ( const asw::Texture & texture,
bool autoSize = true )
inline

Set the texture of the sprite.

Parameters
textureThe texture to set.
autoSizeWhether or not to automatically set the size of the sprite based on the texture dimensions.

Definition at line 106 of file game.h.

◆ update()

void asw::game::Sprite::update ( float deltaTime)
inlineoverridevirtual

Update the sprite.

Parameters
deltaTimeThe time since the last update.

Reimplemented from asw::game::GameObject.

Definition at line 118 of file game.h.

Member Data Documentation

◆ texture

asw::Texture asw::game::Sprite::texture
private

The texture of the sprite.

Definition at line 147 of file game.h.


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