Las clases text y menu ya acceden a resource

This commit is contained in:
2022-10-27 12:43:28 +02:00
parent 4133dfd7c9
commit 9d9d9d92f2
13 changed files with 51 additions and 26 deletions

View File

@@ -4,20 +4,22 @@
#include <fstream>
// Constructor
Text::Text(std::string bitmapFile, std::string textFile, SDL_Renderer *renderer)
Text::Text(std::string bitmapFile, std::string textFile, Resource *resource, SDL_Renderer *renderer)
{
// Copia punteros
this->resource = resource;
// Carga los offsets desde el fichero
initOffsetFromFile(textFile);
// Crea los objetos
texture = new Texture(renderer, bitmapFile);
texture = resource->getTexture(bitmapFile);
sprite = new Sprite({0, 0, boxWidth, boxHeight}, texture, renderer);
}
// Destructor
Text::~Text()
{
delete texture;
delete sprite;
}