61 if (rect->x + rect->w < 0 || rect->x > 640 || rect->y + rect->h < 0 || rect->y > 480)
66 SDL_RendererFlip flip = (SDL_RendererFlip)(hFlip | vFlip);
72 SDL_SetTextureColorMod(
m_texture, color.r, color.g, color.b);
GameObject * m_owner
Pointer to the GameObject that owns this component.
void setName(std::string name)
Sets the name of the component.
T * getComponent()
Gets a component of the specified type.
SDL_Renderer * getRenderer()
Gets the current renderer.
static ResourceManager & getInstance()
Retrieves the singleton instance of ResourceManager.
Component for handling textures in the game engine.
virtual void update() override
Updates texture properties, used mainly for animations or transformations.
bool m_flipHorizontal
Flag for horizontal flipping of the texture.
virtual void setTexture(SDL_Texture *texture)
Sets the SDL_Texture object.
float m_angle
Rotation angle of the texture in degrees.
SDL_Rect * m_spriteClip
Source rectangle in the sprite sheet for slicing the texture.
virtual void setAngle(float angle)
Sets the rotation angle of the texture.
virtual void setPositionInSpriteMap(int x, int y)
Sets the position of the sprite in the sprite map.
SDL_Texture * m_texture
Pointer to the SDL_Texture object.
Texture()
Default constructor for the Texture class, initializes an empty texture.
virtual void setFlipHorizontal(bool flip)
Sets horizontal flip status.
SDL_Texture * getTexture()
Retrieves the SDL_Texture object.
void setColorMod(const SDL_Color &color)
Sets the color modulation for the texture.
virtual void render() override
Renders the texture to the screen based on current properties.
SDL_Rect * m_spriteBox
Destination rectangle on the screen for rendering the texture.
virtual void setFlipVertical(bool flip)
Sets vertical flip status.
bool m_flipVertical
Flag for vertical flipping of the texture.
SDL_Renderer * m_renderer
Pointer to the SDL_Renderer associated with this texture.
virtual void setSizeInSpriteMap(int w, int h)
Sets the size of the sprite in the sprite map.
Manages resources such as textures, fonts, and potentially sounds for a game engine.
Defines the Texture component for managing textures within the Game Engine, encapsulating SDL texture...