41 lines
774 B
C++
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);
|
|
};
|