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 set_texture (const asw::Texture &texture, bool auto_size=true)
 Set the texture of the sprite.
 
void draw () override
 Draw the sprite to the screen.
 
- Public Member Functions inherited from asw::game::GameObject
 GameObject ()=default
 
virtual ~GameObject ()=default
 
virtual void update (float dt)
 Update the object.
 
const asw::Quad< float > & get_transform () 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.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

Sprite Object.

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

◆ set_texture()

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

Set the texture of the sprite.

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

Definition at line 117 of file game.h.

Member Data Documentation

◆ texture_

asw::Texture asw::game::Sprite::texture_
private

The texture of the sprite.

Definition at line 154 of file game.h.


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