9#ifndef ASW_COMPONENTS_H
10#define ASW_COMPONENTS_H
47 virtual void update(
float deltaTime) {
Vec2< T > size
The size of the rectangle.
Vec2< T > position
The position of the rectangle.
const asw::Quad< float > & getTransform() const
Get transform.
bool active
Whether or not the object is active.
float alpha
Opacity of the object.
asw::Quad< float > transform
The transform of the object.
Physics body
Physics body of the object.
virtual void update(float deltaTime)
Update the object.
virtual ~GameObject()=default
int zIndex
The layer that the object is on.
float rotation
The rotation of the object in degrees.
virtual void draw()
Draw the object to the screen.
asw::Vec2< float > acceleration
float angularAcceleration
asw::Vec2< float > velocity
void setTexture(const asw::Texture &texture, bool autoSize=true)
Set the texture of the sprite.
void draw() override
Draw the sprite to the screen.
void update(float deltaTime) override
Update the sprite.
asw::Texture texture
The texture of the sprite.
void setText(const std::string &text)
Set the text of the text object.
void draw() override
Draw the object to the screen.
void setColor(const asw::Color &color)
Set the color of the text.
void setFont(const asw::Font &font)
Set the font of the text.
void update(float deltaTime) override
Set the size of the text.
Routines for drawing sprites and primitives to the screen.
void stretchSprite(const asw::Texture &tex, const asw::Quad< float > &position)
Draw a sprite with the option to stretch it.
void rotateSprite(const asw::Texture &tex, const asw::Vec2< float > &position, double angle)
Draw a sprite with the option to rotate it.
void setAlpha(const asw::Texture &texture, float alpha)
Set the alpha of a texture.
void text(const asw::Font &font, const std::string &text, const asw::Vec2< float > &position, asw::Color color)
Draw text left aligned.
asw::Vec2< float > getTextureSize(const asw::Texture &tex)
Get texture size.
std::shared_ptr< TTF_Font > Font
Alias for a shared pointer to an TTF_Font.
std::shared_ptr< SDL_Texture > Texture
Alias for a shared pointer to an SDL_Texture.
SDL_Color Color
Alias for an SDL_Color.
General utility functions.