The Table Engine
|
Component for handling textures in the game engine. More...
#include <texture.h>
Public Member Functions | |
Texture () | |
Default constructor for the Texture class, initializes an empty texture. More... | |
Texture (SDL_Texture *texture) | |
Constructor with texture initialization. More... | |
SDL_Texture * | getTexture () |
Retrieves the SDL_Texture object. More... | |
virtual void | setTexture (SDL_Texture *texture) |
Sets the SDL_Texture object. More... | |
virtual void | setSizeInSpriteMap (int w, int h) |
Sets the size of the sprite in the sprite map. More... | |
virtual void | setPositionInSpriteMap (int x, int y) |
Sets the position of the sprite in the sprite map. More... | |
virtual void | setFlipHorizontal (bool flip) |
Sets horizontal flip status. More... | |
virtual void | setFlipVertical (bool flip) |
Sets vertical flip status. More... | |
virtual void | setAngle (float angle) |
Sets the rotation angle of the texture. More... | |
virtual void | update () override |
Updates texture properties, used mainly for animations or transformations. More... | |
virtual void | render () override |
Renders the texture to the screen based on current properties. More... | |
void | setColorMod (const SDL_Color &color) |
Sets the color modulation for the texture. More... | |
![]() | |
Component () | |
Default constructor for the Component. More... | |
Component (std::string name) | |
Constructs a Component with a specified name. More... | |
virtual | ~Component () |
Virtual destructor for safe polymorphic use. More... | |
std::string | getName () |
Retrieves the name of the component. More... | |
GameObject * | getOwner () |
Retrieves the GameObject that owns this component. More... | |
void | setName (std::string name) |
Sets the name of the component. More... | |
void | setOwner (GameObject *owner) |
Sets the GameObject owner of this component. More... | |
virtual void | input () |
Virtual method for handling input, intended to be overridden by derived components. More... | |
Protected Attributes | |
SDL_Texture * | m_texture |
Pointer to the SDL_Texture object. More... | |
SDL_Renderer * | m_renderer |
Pointer to the SDL_Renderer associated with this texture. More... | |
SDL_Rect * | m_spriteBox |
Destination rectangle on the screen for rendering the texture. More... | |
SDL_Rect * | m_spriteClip |
Source rectangle in the sprite sheet for slicing the texture. More... | |
bool | m_flipHorizontal = false |
Flag for horizontal flipping of the texture. More... | |
bool | m_flipVertical = false |
Flag for vertical flipping of the texture. More... | |
float | m_angle = 0.0f |
Rotation angle of the texture in degrees. More... | |
![]() | |
std::string | m_name |
Name of the component, useful for identification or debugging. More... | |
GameObject * | m_owner |
Pointer to the GameObject that owns this component. More... | |
Component for handling textures in the game engine.
The Texture class extends the Component class, providing specific functionalities for texture management including handling sprite sheets, texture transformations, and rendering operations.
Texture::Texture | ( | ) |
Default constructor for the Texture class, initializes an empty texture.
Definition at line 5 of file texture.cpp.
Texture::Texture | ( | SDL_Texture * | texture | ) |
Constructor with texture initialization.
texture | Pointer to an SDL_Texture to be managed. |
Definition at line 13 of file texture.cpp.
SDL_Texture * Texture::getTexture | ( | ) |
Retrieves the SDL_Texture object.
Definition at line 17 of file texture.cpp.
|
overridevirtual |
Renders the texture to the screen based on current properties.
Reimplemented from Component.
Reimplemented in AnimationsManager.
Definition at line 59 of file texture.cpp.
|
virtual |
Sets the rotation angle of the texture.
angle | Rotation angle in degrees. |
Reimplemented in AnimationsManager.
Definition at line 51 of file texture.cpp.
void Texture::setColorMod | ( | const SDL_Color & | color | ) |
Sets the color modulation for the texture.
color | SDL_Color structure containing the RGB values to modulate the texture. |
Definition at line 71 of file texture.cpp.
|
virtual |
Sets horizontal flip status.
flip | True to flip the texture horizontally, false otherwise. |
Reimplemented in AnimationsManager.
Definition at line 43 of file texture.cpp.
|
virtual |
Sets vertical flip status.
flip | True to flip the texture vertically, false otherwise. |
Reimplemented in AnimationsManager.
Definition at line 47 of file texture.cpp.
|
virtual |
Sets the position of the sprite in the sprite map.
x | Horizontal position of the sprite in the sprite sheet. |
y | Vertical position of the sprite in the sprite sheet. |
Reimplemented in AnimationsManager.
Definition at line 37 of file texture.cpp.
|
virtual |
Sets the size of the sprite in the sprite map.
w | Width of the sprite in the sprite sheet. |
h | Height of the sprite in the sprite sheet. |
Reimplemented in AnimationsManager.
Definition at line 31 of file texture.cpp.
|
virtual |
Sets the SDL_Texture object.
texture | Pointer to the new SDL_Texture to be managed. |
Reimplemented in AnimationsManager.
Definition at line 21 of file texture.cpp.
|
overridevirtual |
Updates texture properties, used mainly for animations or transformations.
Reimplemented from Component.
Reimplemented in AnimationsManager, and Animation.
Definition at line 55 of file texture.cpp.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |