JA VA! Nomes s'havia de fer les coses be i no ser un ansias
This commit is contained in:
@@ -9,13 +9,14 @@
|
||||
#include "texture.h" // Para Texture
|
||||
#include "utils.h" // Para options_t
|
||||
#include "screen.h"
|
||||
#include "options.h"
|
||||
|
||||
// Carga las texturas de una lista
|
||||
void Resource::loadTextures(std::vector<std::string> list)
|
||||
{
|
||||
for (auto l : list)
|
||||
{
|
||||
if (options_->console)
|
||||
if (options.console)
|
||||
{
|
||||
std::cout << "\nLOAD TEXTURE: " << l << std::endl;
|
||||
std::cout << "png: " << Asset::get()->get(l) << std::endl;
|
||||
@@ -23,7 +24,7 @@ void Resource::loadTextures(std::vector<std::string> list)
|
||||
|
||||
res_texture_t t;
|
||||
t.name = l;
|
||||
t.texture = new Texture(Screen::get()->getRenderer(), Asset::get()->get(t.name), options_->console);
|
||||
t.texture = new Texture(Screen::get()->getRenderer(), Asset::get()->get(t.name), options.console);
|
||||
textures_.push_back(t);
|
||||
}
|
||||
}
|
||||
@@ -45,7 +46,7 @@ void Resource::loadAnimations(std::vector<std::string> list)
|
||||
// Extrae el nombre del fichero sin la extension para crear el nombre del fichero de la textura
|
||||
const std::string pngFile = l.substr(0, l.find_last_of(".")) + ".png";
|
||||
|
||||
if (options_->console)
|
||||
if (options.console)
|
||||
{
|
||||
std::cout << "\nLOAD ANIMATION: " << l << std::endl;
|
||||
std::cout << "png: " << Asset::get()->get(pngFile) << std::endl;
|
||||
@@ -54,7 +55,7 @@ void Resource::loadAnimations(std::vector<std::string> list)
|
||||
|
||||
res_animation_t as;
|
||||
as.name = l;
|
||||
as.animation = new animatedSprite_t(loadAnimationFromFile(getTexture(pngFile), Asset::get()->get(as.name), options_->console));
|
||||
as.animation = new animatedSprite_t(loadAnimationFromFile(getTexture(pngFile), Asset::get()->get(as.name), options.console));
|
||||
animations_.push_back(as);
|
||||
}
|
||||
}
|
||||
@@ -69,7 +70,7 @@ void Resource::reLoadAnimations()
|
||||
// Extrae el nombre del fichero sin la extension para crear el nombre del fichero de la textura
|
||||
const std::string pngFile = a.name.substr(0, a.name.find_last_of(".")) + ".png";
|
||||
delete a.animation;
|
||||
a.animation = new animatedSprite_t(loadAnimationFromFile(getTexture(pngFile), Asset::get()->get(a.name), options_->console));
|
||||
a.animation = new animatedSprite_t(loadAnimationFromFile(getTexture(pngFile), Asset::get()->get(a.name), options.console));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +81,7 @@ void Resource::loadOffsets(std::vector<std::string> list)
|
||||
{
|
||||
res_textOffset_t to;
|
||||
to.name = l;
|
||||
to.textFile = new textFile_t(LoadTextFile(Asset::get()->get(l), options_->console));
|
||||
to.textFile = new textFile_t(LoadTextFile(Asset::get()->get(l), options.console));
|
||||
offsets_.push_back(to);
|
||||
}
|
||||
}
|
||||
@@ -91,7 +92,7 @@ void Resource::reLoadOffsets()
|
||||
for (auto &o : offsets_)
|
||||
{
|
||||
delete o.textFile;
|
||||
o.textFile = new textFile_t(LoadTextFile(Asset::get()->get(o.name), options_->console));
|
||||
o.textFile = new textFile_t(LoadTextFile(Asset::get()->get(o.name), options.console));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +103,7 @@ void Resource::loadTileMaps(std::vector<std::string> list)
|
||||
{
|
||||
res_tileMap_t tm;
|
||||
tm.name = l;
|
||||
tm.tileMap = new std::vector<int>(loadRoomTileFile(Asset::get()->get(l), options_->console));
|
||||
tm.tileMap = new std::vector<int>(loadRoomTileFile(Asset::get()->get(l), options.console));
|
||||
tile_maps_.push_back(tm);
|
||||
}
|
||||
}
|
||||
@@ -113,7 +114,7 @@ void Resource::reLoadTileMaps()
|
||||
for (auto &tm : tile_maps_)
|
||||
{
|
||||
delete tm.tileMap;
|
||||
tm.tileMap = new std::vector<int>(loadRoomTileFile(Asset::get()->get(tm.name), options_->console));
|
||||
tm.tileMap = new std::vector<int>(loadRoomTileFile(Asset::get()->get(tm.name), options.console));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +125,7 @@ void Resource::loadRooms(std::vector<std::string> list)
|
||||
{
|
||||
res_room_t r;
|
||||
r.name = l;
|
||||
r.room = new room_t(loadRoomFile(Asset::get()->get(l), options_->console));
|
||||
r.room = new room_t(loadRoomFile(Asset::get()->get(l), options.console));
|
||||
r.room->tileMap = getTileMap(r.room->tileMapFile);
|
||||
for (auto &e : r.room->enemies)
|
||||
{
|
||||
@@ -246,7 +247,7 @@ Texture *Resource::getTexture(std::string name)
|
||||
}
|
||||
}
|
||||
|
||||
if (options_->console)
|
||||
if (options.console)
|
||||
{
|
||||
std::cout << "NOT FOUND ON CACHE: " << name << std::endl;
|
||||
}
|
||||
@@ -267,7 +268,7 @@ animatedSprite_t *Resource::getAnimation(std::string name)
|
||||
}
|
||||
}
|
||||
|
||||
if (options_->console)
|
||||
if (options.console)
|
||||
{
|
||||
std::cout << "NOT FOUND ON CACHE: " << name << std::endl;
|
||||
}
|
||||
@@ -286,7 +287,7 @@ textFile_t *Resource::getOffset(std::string name)
|
||||
}
|
||||
}
|
||||
|
||||
if (options_->console)
|
||||
if (options.console)
|
||||
{
|
||||
std::cout << "NOT FOUND ON CACHE: " << name << std::endl;
|
||||
}
|
||||
@@ -305,7 +306,7 @@ std::vector<int> *Resource::getTileMap(std::string name)
|
||||
}
|
||||
}
|
||||
|
||||
if (options_->console)
|
||||
if (options.console)
|
||||
{
|
||||
std::cout << "NOT FOUND ON CACHE: " << name << std::endl;
|
||||
}
|
||||
@@ -324,7 +325,7 @@ room_t *Resource::getRoom(std::string name)
|
||||
}
|
||||
}
|
||||
|
||||
if (options_->console)
|
||||
if (options.console)
|
||||
{
|
||||
std::cout << "NOT FOUND ON CACHE: " << name << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user