Files
demo5_sprites_bouncing/source/texture.h
2025-03-24 12:48:32 +01:00

41 lines
774 B
C++

#pragma once
#include <SDL3/SDL.h>
#include <iostream>
// Texture wrapper class
class Texture
{
private:
SDL_Renderer *renderer_;
SDL_Texture *texture_;
// Image dimensions
int width_;
int height_;
public:
// Initializes variables
Texture(SDL_Renderer *renderer);
Texture(SDL_Renderer *renderer, std::string file_path);
// Deallocates memory
~Texture();
// Loads image at specified path
bool loadFromFile(std::string path);
// Deallocates texture
void free();
// Renders texture at given point
void render(SDL_FRect *src = nullptr, SDL_FRect *dst = nullptr);
// Gets image dimensions
int getWidth();
int getHeight();
// Modulación de color
void setColor(int r, int g, int b);
};