Files
demo5_sprites_bouncing/source/texture.h
Sergio Valor 36cb6154d7 Primer commit
la pilota no deixa de botar mai
2024-08-21 10:42:37 +02:00

41 lines
767 B
C++

#pragma once
#include <SDL2/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 filepath);
// 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_Rect *src = nullptr, SDL_Rect *dst = nullptr);
// Gets image dimensions
int getWidth();
int getHeight();
// Modulación de color
void setColor(int r, int g, int b);
};