using namespace std en todos los ficheros

This commit is contained in:
2023-05-23 17:40:12 +02:00
parent 5a5bbf7f73
commit c31bfc6cae
15 changed files with 218 additions and 197 deletions

View File

@@ -5,9 +5,9 @@
#include <iostream>
// Constructor
Texture::Texture(SDL_Renderer *renderer, std::string path, bool verbose)
Texture::Texture(SDL_Renderer *renderer, string path, bool verbose)
{
//std::cout << "Construido Texture" << std::endl;
//cout << "Construido Texture" << endl;
// Copia punteros
this->renderer = renderer;
this->path = path;
@@ -27,16 +27,16 @@ Texture::Texture(SDL_Renderer *renderer, std::string path, bool verbose)
// Destructor
Texture::~Texture()
{
//std::cout << "Destruido Texture" << std::endl;
//cout << "Destruido Texture" << endl;
// Libera memoria
unload();
}
// Carga una imagen desde un fichero
bool Texture::loadFromFile(std::string path, SDL_Renderer *renderer, bool verbose)
bool Texture::loadFromFile(string path, SDL_Renderer *renderer, bool verbose)
{
const std::string filename = path.substr(path.find_last_of("\\/") + 1);
const string filename = path.substr(path.find_last_of("\\/") + 1);
int req_format = STBI_rgb_alpha;
int width, height, orig_format;
unsigned char *data = stbi_load(path.c_str(), &width, &height, &orig_format, req_format);
@@ -49,7 +49,7 @@ bool Texture::loadFromFile(std::string path, SDL_Renderer *renderer, bool verbos
{
if (verbose)
{
std::cout << "Image loaded: " << filename.c_str() << std::endl;
cout << "Image loaded: " << filename.c_str() << endl;
}
}
@@ -80,7 +80,7 @@ bool Texture::loadFromFile(std::string path, SDL_Renderer *renderer, bool verbos
{
if (verbose)
{
std::cout << "Unable to load image " << path.c_str() << std::endl;
cout << "Unable to load image " << path.c_str() << endl;
}
}
else
@@ -91,7 +91,7 @@ bool Texture::loadFromFile(std::string path, SDL_Renderer *renderer, bool verbos
{
if (verbose)
{
std::cout << "Unable to create texture from " << path.c_str() << "! SDL Error: " << SDL_GetError() << std::endl;
cout << "Unable to create texture from " << path.c_str() << "! SDL Error: " << SDL_GetError() << endl;
}
}
else
@@ -118,7 +118,7 @@ bool Texture::createBlank(SDL_Renderer *renderer, int width, int height, SDL_Tex
texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, access, width, height);
if (texture == nullptr)
{
std::cout << "Unable to create blank texture! SDL Error: " << SDL_GetError() << std::endl;
cout << "Unable to create blank texture! SDL Error: " << SDL_GetError() << endl;
}
else
{