Quitados todos los printf menos uno
This commit is contained in:
@@ -73,7 +73,7 @@ animatedSprite_t loadAnimationFromFile(Texture *texture, std::string filePath)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Warning: file %s, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (line != "[/animation]");
|
} while (line != "[/animation]");
|
||||||
@@ -108,7 +108,7 @@ animatedSprite_t loadAnimationFromFile(Texture *texture, std::string filePath)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Warning: file %s, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normaliza valores
|
// Normaliza valores
|
||||||
@@ -133,11 +133,11 @@ animatedSprite_t loadAnimationFromFile(Texture *texture, std::string filePath)
|
|||||||
// El fichero no se puede abrir
|
// El fichero no se puede abrir
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Warning: Unable to open %s file\n", filename.c_str());
|
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pone un valor por defecto
|
// Pone un valor por defecto
|
||||||
//setRect({0, 0, frameWidth, frameHeight});
|
// setRect({0, 0, frameWidth, frameHeight});
|
||||||
|
|
||||||
return as;
|
return as;
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ int AnimatedSprite::getIndex(std::string name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("** Warning: could not find \"%s\" animation\n", name.c_str());
|
std::cout << "** Warning: could not find \"" << name.c_str() << "\" animation" << std::endl;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -409,7 +409,7 @@ animatedSprite_t AnimatedSprite::loadFromFile(std::string filePath)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Warning: file %s, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (line != "[/animation]");
|
} while (line != "[/animation]");
|
||||||
@@ -445,7 +445,7 @@ animatedSprite_t AnimatedSprite::loadFromFile(std::string filePath)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Warning: file %s, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normaliza valores
|
// Normaliza valores
|
||||||
@@ -470,7 +470,7 @@ animatedSprite_t AnimatedSprite::loadFromFile(std::string filePath)
|
|||||||
// El fichero no se puede abrir
|
// El fichero no se puede abrir
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Warning: Unable to open %s file\n", filename.c_str());
|
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pone un valor por defecto
|
// Pone un valor por defecto
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "asset.h"
|
#include "asset.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Asset::Asset(std::string path)
|
Asset::Asset(std::string path)
|
||||||
@@ -31,7 +32,7 @@ std::string Asset::get(std::string text)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Warning: file %s not found\n", text.c_str());
|
std::cout << "Warning: file " << text.c_str() << " not found" << std::endl;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ bool Asset::check()
|
|||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
printf("\n** Checking files.\n");
|
std::cout << "\n** Checking files." << std::endl;
|
||||||
|
|
||||||
// Comprueba la lista de ficheros clasificandolos por tipo
|
// Comprueba la lista de ficheros clasificandolos por tipo
|
||||||
for (int type = 0; type < t_maxAssetType; ++type)
|
for (int type = 0; type < t_maxAssetType; ++type)
|
||||||
@@ -59,7 +60,7 @@ bool Asset::check()
|
|||||||
// Si hay ficheros de ese tipo, comprueba si existen
|
// Si hay ficheros de ese tipo, comprueba si existen
|
||||||
if (any)
|
if (any)
|
||||||
{
|
{
|
||||||
printf("\n>> %s FILES\n", getTypeName(type).c_str());
|
std::cout << "\n>> " << getTypeName(type).c_str() << " FILES" << std::endl;
|
||||||
|
|
||||||
for (auto f : fileList)
|
for (auto f : fileList)
|
||||||
{
|
{
|
||||||
@@ -74,11 +75,13 @@ bool Asset::check()
|
|||||||
// Resultado
|
// Resultado
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
printf("\n** All files OK.\n\n");
|
std::cout << "\n** All files OK.\n"
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("\n** A file is missing. Exiting.\n\n");
|
std::cout << "\n** A file is missing. Exiting.\n"
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ bool Menu::load(std::string file_path)
|
|||||||
if (file.good())
|
if (file.good())
|
||||||
{
|
{
|
||||||
// Procesa el fichero linea a linea
|
// Procesa el fichero linea a linea
|
||||||
printf("Reading file %s\n", filename.c_str());
|
std::cout << "Reading file " << filename.c_str() << std::endl;
|
||||||
while (std::getline(file, line))
|
while (std::getline(file, line))
|
||||||
{
|
{
|
||||||
if (line == "[item]")
|
if (line == "[item]")
|
||||||
@@ -130,7 +130,7 @@ bool Menu::load(std::string file_path)
|
|||||||
// Procesa las dos subcadenas
|
// Procesa las dos subcadenas
|
||||||
if (!setItem(&item, line.substr(0, pos), line.substr(pos + 1, line.length())))
|
if (!setItem(&item, line.substr(0, pos), line.substr(pos + 1, line.length())))
|
||||||
{
|
{
|
||||||
printf("Warning: file %s\n, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ bool Menu::load(std::string file_path)
|
|||||||
// Procesa las dos subcadenas
|
// Procesa las dos subcadenas
|
||||||
if (!setVars(line.substr(0, pos), line.substr(pos + 1, line.length())))
|
if (!setVars(line.substr(0, pos), line.substr(pos + 1, line.length())))
|
||||||
{
|
{
|
||||||
printf("Warning: file %s, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,13 +161,13 @@ bool Menu::load(std::string file_path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cierra el fichero
|
// Cierra el fichero
|
||||||
printf("Closing file %s\n", filename.c_str());
|
std::cout << "Closing file " << filename.c_str() << std::endl;
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
// El fichero no se puede abrir
|
// El fichero no se puede abrir
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Warning: Unable to open %s file\n", filename.c_str());
|
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << std::endl;
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ bool Menu::setItem(item_t *item, std::string var, std::string value)
|
|||||||
else if ((var == "") || (var == "[/item]"))
|
else if ((var == "") || (var == "[/item]"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
success = false;
|
success = false;
|
||||||
@@ -405,7 +405,7 @@ void Menu::updateSelector()
|
|||||||
selector.moving = false;
|
selector.moving = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (selector.despY < 0) // Va hacia arriba
|
else if (selector.despY < 0) // Va hacia arriba
|
||||||
{
|
{
|
||||||
if (selector.y < selector.targetY) // Ha llegado al destino
|
if (selector.y < selector.targetY) // Ha llegado al destino
|
||||||
@@ -434,7 +434,7 @@ void Menu::updateSelector()
|
|||||||
selector.resizing = false;
|
selector.resizing = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (selector.incH < 0) // Decrece
|
else if (selector.incH < 0) // Decrece
|
||||||
{
|
{
|
||||||
if (selector.h < selector.targetH) // Ha llegado al destino
|
if (selector.h < selector.targetH) // Ha llegado al destino
|
||||||
@@ -642,7 +642,7 @@ void Menu::render()
|
|||||||
{
|
{
|
||||||
text->writeColored(item.at(i).rect.x, item.at(i).rect.y, item.at(i).label, colorGreyed);
|
text->writeColored(item.at(i).rect.x, item.at(i).rect.y, item.at(i).label, colorGreyed);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{ // No seleccionable
|
{ // No seleccionable
|
||||||
if ((item.at(i).linkedUp) && (i == selector.index + 1))
|
if ((item.at(i).linkedUp) && (i == selector.index + 1))
|
||||||
|
|||||||
@@ -50,14 +50,14 @@ textFile_t LoadTextFile(std::string file)
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Cierra el fichero
|
// Cierra el fichero
|
||||||
printf("Text loaded: %s\n", filename.c_str());
|
std::cout << "Text loaded: " << filename.c_str() << std::endl;
|
||||||
rfile.close();
|
rfile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// El fichero no se puede abrir
|
// El fichero no se puede abrir
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Warning: Unable to open %s file\n", filename.c_str());
|
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establece las coordenadas para cada caracter ascii de la cadena y su ancho
|
// Establece las coordenadas para cada caracter ascii de la cadena y su ancho
|
||||||
@@ -243,14 +243,14 @@ void Text::initOffsetFromFile(std::string file)
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Cierra el fichero
|
// Cierra el fichero
|
||||||
printf("Text loaded: %s\n", filename.c_str());
|
std::cout << "Text loaded: " << filename.c_str() << std::endl;
|
||||||
rfile.close();
|
rfile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
// El fichero no se puede abrir
|
// El fichero no se puede abrir
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Warning: Unable to open %s file\n", filename.c_str());
|
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establece las coordenadas para cada caracter ascii de la cadena y su ancho
|
// Establece las coordenadas para cada caracter ascii de la cadena y su ancho
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
#define STB_IMAGE_IMPLEMENTATION
|
#define STB_IMAGE_IMPLEMENTATION
|
||||||
#include "stb_image.h"
|
#include "stb_image.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Texture::Texture(SDL_Renderer *renderer, std::string path)
|
Texture::Texture(SDL_Renderer *renderer, std::string path)
|
||||||
@@ -32,7 +33,7 @@ Texture::~Texture()
|
|||||||
// Carga una imagen desde un fichero
|
// Carga una imagen desde un fichero
|
||||||
bool Texture::loadFromFile(std::string path, SDL_Renderer *renderer)
|
bool Texture::loadFromFile(std::string path, SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
const std::string filename = path.substr(path.find_last_of("\\/") + 1);
|
const std::string filename = path.substr(path.find_last_of("\\/") + 1);
|
||||||
int req_format = STBI_rgb_alpha;
|
int req_format = STBI_rgb_alpha;
|
||||||
int width, height, orig_format;
|
int width, height, orig_format;
|
||||||
unsigned char *data = stbi_load(path.c_str(), &width, &height, &orig_format, req_format);
|
unsigned char *data = stbi_load(path.c_str(), &width, &height, &orig_format, req_format);
|
||||||
@@ -43,7 +44,7 @@ bool Texture::loadFromFile(std::string path, SDL_Renderer *renderer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Image loaded: %s\n", filename.c_str());
|
std::cout << "Image loaded: " << filename.c_str() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int depth, pitch;
|
int depth, pitch;
|
||||||
@@ -71,7 +72,7 @@ bool Texture::loadFromFile(std::string path, SDL_Renderer *renderer)
|
|||||||
SDL_Surface *loadedSurface = SDL_CreateRGBSurfaceWithFormatFrom((void *)data, width, height, depth, pitch, pixel_format);
|
SDL_Surface *loadedSurface = SDL_CreateRGBSurfaceWithFormatFrom((void *)data, width, height, depth, pitch, pixel_format);
|
||||||
if (loadedSurface == nullptr)
|
if (loadedSurface == nullptr)
|
||||||
{
|
{
|
||||||
printf("Unable to load image %s!\n", path.c_str());
|
std::cout << "Unable to load image " << path.c_str() << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -79,7 +80,7 @@ bool Texture::loadFromFile(std::string path, SDL_Renderer *renderer)
|
|||||||
newTexture = SDL_CreateTextureFromSurface(renderer, loadedSurface);
|
newTexture = SDL_CreateTextureFromSurface(renderer, loadedSurface);
|
||||||
if (newTexture == nullptr)
|
if (newTexture == nullptr)
|
||||||
{
|
{
|
||||||
printf("Unable to create texture from %s! SDL Error: %s\n", path.c_str(), SDL_GetError());
|
std::cout << "Unable to create texture from " << path.c_str() << "! SDL Error: " << SDL_GetError() << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -104,7 +105,7 @@ bool Texture::createBlank(SDL_Renderer *renderer, int width, int height, SDL_Tex
|
|||||||
texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, access, width, height);
|
texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, access, width, height);
|
||||||
if (texture == nullptr)
|
if (texture == nullptr)
|
||||||
{
|
{
|
||||||
printf("Unable to create blank texture! SDL Error: %s\n", SDL_GetError());
|
std::cout << "Unable to create blank texture! SDL Error: " << SDL_GetError() << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -990,8 +990,7 @@ void Director::setSection(section_t section)
|
|||||||
// Ejecuta la seccion de juego con el logo
|
// Ejecuta la seccion de juego con el logo
|
||||||
void Director::runLogo()
|
void Director::runLogo()
|
||||||
{
|
{
|
||||||
std::cout << std::endl
|
std::cout << "\n* SECTION: LOGO" << std::endl;
|
||||||
<< "* SECTION: LOGO" << std::endl;
|
|
||||||
loadResources(section);
|
loadResources(section);
|
||||||
logo = new Logo(renderer, screen, resource, asset, options, section.subsection);
|
logo = new Logo(renderer, screen, resource, asset, options, section.subsection);
|
||||||
setSection(logo->run());
|
setSection(logo->run());
|
||||||
@@ -1002,8 +1001,7 @@ void Director::runLogo()
|
|||||||
// Ejecuta la seccion de juego de la introducción
|
// Ejecuta la seccion de juego de la introducción
|
||||||
void Director::runIntro()
|
void Director::runIntro()
|
||||||
{
|
{
|
||||||
std::cout << std::endl
|
std::cout << "\n* SECTION: INTRO" << std::endl;
|
||||||
<< "* SECTION: INTRO" << std::endl;
|
|
||||||
loadResources(section);
|
loadResources(section);
|
||||||
intro = new Intro(renderer, screen, resource, asset, options);
|
intro = new Intro(renderer, screen, resource, asset, options);
|
||||||
setSection(intro->run());
|
setSection(intro->run());
|
||||||
@@ -1014,8 +1012,7 @@ void Director::runIntro()
|
|||||||
// Ejecuta la seccion de juego con el titulo y los menus
|
// Ejecuta la seccion de juego con el titulo y los menus
|
||||||
void Director::runTitle()
|
void Director::runTitle()
|
||||||
{
|
{
|
||||||
std::cout << std::endl
|
std::cout << "\n* SECTION: TITLE" << std::endl;
|
||||||
<< "* SECTION: TITLE" << std::endl;
|
|
||||||
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED))
|
if ((JA_GetMusicState() == JA_MUSIC_INVALID) || (JA_GetMusicState() == JA_MUSIC_STOPPED))
|
||||||
{
|
{
|
||||||
JA_PlayMusic(music);
|
JA_PlayMusic(music);
|
||||||
@@ -1030,8 +1027,7 @@ void Director::runTitle()
|
|||||||
// Ejecuta la seccion de los creditos del juego
|
// Ejecuta la seccion de los creditos del juego
|
||||||
void Director::runCredits()
|
void Director::runCredits()
|
||||||
{
|
{
|
||||||
std::cout << std::endl
|
std::cout << "\n* SECTION: CREDITS" << std::endl;
|
||||||
<< "* SECTION: CREDITS" << std::endl;
|
|
||||||
loadResources(section);
|
loadResources(section);
|
||||||
credits = new Credits(renderer, screen, resource, asset, options);
|
credits = new Credits(renderer, screen, resource, asset, options);
|
||||||
setSection(credits->run());
|
setSection(credits->run());
|
||||||
@@ -1042,8 +1038,7 @@ void Director::runCredits()
|
|||||||
// Ejecuta la seccion de la demo, donde se ven pantallas del juego
|
// Ejecuta la seccion de la demo, donde se ven pantallas del juego
|
||||||
void Director::runDemo()
|
void Director::runDemo()
|
||||||
{
|
{
|
||||||
std::cout << std::endl
|
std::cout << "\n* SECTION: DEMO" << std::endl;
|
||||||
<< "* SECTION: DEMO" << std::endl;
|
|
||||||
loadResources(section);
|
loadResources(section);
|
||||||
demo = new Demo(renderer, screen, resource, asset, options, debug);
|
demo = new Demo(renderer, screen, resource, asset, options, debug);
|
||||||
setSection(demo->run());
|
setSection(demo->run());
|
||||||
@@ -1054,8 +1049,7 @@ void Director::runDemo()
|
|||||||
// Ejecuta la seccion de juego donde se juega
|
// Ejecuta la seccion de juego donde se juega
|
||||||
void Director::runGame()
|
void Director::runGame()
|
||||||
{
|
{
|
||||||
std::cout << std::endl
|
std::cout << "\n* SECTION: GAME" << std::endl;
|
||||||
<< "* SECTION: GAME" << std::endl;
|
|
||||||
JA_StopMusic();
|
JA_StopMusic();
|
||||||
loadResources(section);
|
loadResources(section);
|
||||||
game = new Game(renderer, screen, resource, asset, options, input, debug);
|
game = new Game(renderer, screen, resource, asset, options, input, debug);
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ std::vector<int> loadRoomTileFile(std::string file_path)
|
|||||||
if (file.good())
|
if (file.good())
|
||||||
{
|
{
|
||||||
// Procesa el fichero linea a linea
|
// Procesa el fichero linea a linea
|
||||||
// printf("Reading file %s\n", filename.c_str());
|
|
||||||
|
|
||||||
while (std::getline(file, line))
|
while (std::getline(file, line))
|
||||||
{ // Lee el fichero linea a linea
|
{ // Lee el fichero linea a linea
|
||||||
if (line.find("data encoding") != std::string::npos)
|
if (line.find("data encoding") != std::string::npos)
|
||||||
@@ -39,13 +37,13 @@ std::vector<int> loadRoomTileFile(std::string file_path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cierra el fichero
|
// Cierra el fichero
|
||||||
printf("TileMap loaded: %s\n", filename.c_str());
|
std::cout << "TileMap loaded: " << filename.c_str() << std::endl;
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{ // El fichero no se puede abrir
|
{ // El fichero no se puede abrir
|
||||||
printf("Warning: Unable to open %s file\n", filename.c_str());
|
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tileMapFile;
|
return tileMapFile;
|
||||||
@@ -86,7 +84,7 @@ room_t loadRoomFile(std::string file_path)
|
|||||||
// Procesa las dos subcadenas
|
// Procesa las dos subcadenas
|
||||||
if (!setEnemy(&enemy, line.substr(0, pos), line.substr(pos + 1, line.length())))
|
if (!setEnemy(&enemy, line.substr(0, pos), line.substr(pos + 1, line.length())))
|
||||||
{
|
{
|
||||||
printf("Warning: file %s\n, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||||
}
|
}
|
||||||
} while (line != "[/enemy]");
|
} while (line != "[/enemy]");
|
||||||
|
|
||||||
@@ -112,7 +110,7 @@ room_t loadRoomFile(std::string file_path)
|
|||||||
// Procesa las dos subcadenas
|
// Procesa las dos subcadenas
|
||||||
if (!setItem(&item, line.substr(0, pos), line.substr(pos + 1, line.length())))
|
if (!setItem(&item, line.substr(0, pos), line.substr(pos + 1, line.length())))
|
||||||
{
|
{
|
||||||
printf("Warning: file %s\n, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (line != "[/item]");
|
} while (line != "[/item]");
|
||||||
@@ -129,19 +127,19 @@ room_t loadRoomFile(std::string file_path)
|
|||||||
// Procesa las dos subcadenas
|
// Procesa las dos subcadenas
|
||||||
if (!setVars(&room, line.substr(0, pos), line.substr(pos + 1, line.length())))
|
if (!setVars(&room, line.substr(0, pos), line.substr(pos + 1, line.length())))
|
||||||
{
|
{
|
||||||
printf("Warning: file %s, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
std::cout << "Warning: file " << filename.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cierra el fichero
|
// Cierra el fichero
|
||||||
printf("Room loaded: %s\n", filename.c_str());
|
std::cout << "Room loaded: " << filename.c_str() << std::endl;
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
// El fichero no se puede abrir
|
// El fichero no se puede abrir
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Warning: Unable to open %s file\n", filename.c_str());
|
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return room;
|
return room;
|
||||||
@@ -435,7 +433,7 @@ Room::Room(room_t *room, SDL_Renderer *renderer, Screen *screen, Asset *asset, o
|
|||||||
mapTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT);
|
mapTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT);
|
||||||
if (mapTexture == nullptr)
|
if (mapTexture == nullptr)
|
||||||
{
|
{
|
||||||
printf("Error: mapTexture could not be created!\nSDL Error: %s\n", SDL_GetError());
|
std::cout << "Error: mapTexture could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||||
}
|
}
|
||||||
SDL_SetTextureBlendMode(mapTexture, SDL_BLENDMODE_BLEND);
|
SDL_SetTextureBlendMode(mapTexture, SDL_BLENDMODE_BLEND);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user