forked from jaildesigner-jailgames/jaildoctors_dilemma
Cambiando printf a std::cout
This commit is contained in:
@@ -183,7 +183,7 @@ bool Input::discoverGameController()
|
|||||||
|
|
||||||
if (SDL_GameControllerAddMappingsFromFile(dbPath.c_str()) < 0)
|
if (SDL_GameControllerAddMappingsFromFile(dbPath.c_str()) < 0)
|
||||||
{
|
{
|
||||||
printf("Error, could not load %s file: %s\n", dbPath.c_str(), SDL_GetError());
|
std::cout << "Error, could not load " << dbPath.c_str() << " file: " << SDL_GetError() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int nJoysticks = SDL_NumJoysticks();
|
const int nJoysticks = SDL_NumJoysticks();
|
||||||
@@ -198,8 +198,8 @@ bool Input::discoverGameController()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\nChecking for game controllers...\n");
|
std::cout << "\nChecking for game controllers...\n";
|
||||||
printf("%i joysticks found, %i are gamepads\n", nJoysticks, numGamepads);
|
std::cout << nJoysticks << " joysticks found, " << numGamepads << " are gamepads\n";
|
||||||
|
|
||||||
if (numGamepads > 0)
|
if (numGamepads > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <stdio.h>
|
#include <iostream>
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options, int gameInternalResX, int gameInternalResY)
|
Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options, int gameInternalResX, int gameInternalResY)
|
||||||
@@ -23,7 +23,7 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options, i
|
|||||||
gameCanvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, gameCanvasWidth, gameCanvasHeight);
|
gameCanvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, gameCanvasWidth, gameCanvasHeight);
|
||||||
if (gameCanvas == nullptr)
|
if (gameCanvas == nullptr)
|
||||||
{
|
{
|
||||||
printf("TitleSurface could not be created!\nSDL Error: %s\n", SDL_GetError());
|
std::cout << "TitleSurface could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Establece el modo de video
|
// Establece el modo de video
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "credits.h"
|
#include "credits.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Credits::Credits(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options)
|
Credits::Credits(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *asset, options_t *options)
|
||||||
@@ -32,7 +33,7 @@ Credits::Credits(SDL_Renderer *renderer, Screen *screen, Resource *resource, Ass
|
|||||||
textTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT);
|
textTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT);
|
||||||
if (textTexture == nullptr)
|
if (textTexture == nullptr)
|
||||||
{
|
{
|
||||||
printf("Error: textTexture could not be created!\nSDL Error: %s\n", SDL_GetError());
|
std::cout << "Error: textTexture could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||||
}
|
}
|
||||||
SDL_SetTextureBlendMode(textTexture, SDL_BLENDMODE_BLEND);
|
SDL_SetTextureBlendMode(textTexture, SDL_BLENDMODE_BLEND);
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ Credits::Credits(SDL_Renderer *renderer, Screen *screen, Resource *resource, Ass
|
|||||||
coverTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT);
|
coverTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT);
|
||||||
if (coverTexture == nullptr)
|
if (coverTexture == nullptr)
|
||||||
{
|
{
|
||||||
printf("Error: coverTexture could not be created!\nSDL Error: %s\n", SDL_GetError());
|
std::cout << "Error: textTexture could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||||
}
|
}
|
||||||
SDL_SetTextureBlendMode(coverTexture, SDL_BLENDMODE_BLEND);
|
SDL_SetTextureBlendMode(coverTexture, SDL_BLENDMODE_BLEND);
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ bool Director::loadConfig()
|
|||||||
if (file.good())
|
if (file.good())
|
||||||
{
|
{
|
||||||
// Procesa el fichero linea a linea
|
// Procesa el fichero linea a linea
|
||||||
printf("Reading file config.txt\n");
|
std::cout << "Reading file config.txt\n";
|
||||||
while (std::getline(file, line))
|
while (std::getline(file, line))
|
||||||
{
|
{
|
||||||
// Comprueba que la linea no sea un comentario
|
// Comprueba que la linea no sea un comentario
|
||||||
@@ -96,14 +96,15 @@ bool Director::loadConfig()
|
|||||||
// Procesa las dos subcadenas
|
// Procesa las dos subcadenas
|
||||||
if (!setOptions(options, line.substr(0, pos), line.substr(pos + 1, line.length())))
|
if (!setOptions(options, line.substr(0, pos), line.substr(pos + 1, line.length())))
|
||||||
{
|
{
|
||||||
printf("Warning: file %s\n, unknown parameter \"%s\"\n", "config.txt", line.substr(0, pos).c_str());
|
std::cout << "Warning: file config.txt\n";
|
||||||
|
std::cout << "unknown parameter " << line.substr(0, pos).c_str() << std::endl;
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cierra el fichero
|
// Cierra el fichero
|
||||||
printf("Closing file config.txt\n\n");
|
std::cout << "Closing file config.txt\n\n";
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -634,7 +635,7 @@ bool Director::initSDL()
|
|||||||
// Inicializa SDL
|
// Inicializa SDL
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER | SDL_INIT_AUDIO) < 0)
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER | SDL_INIT_AUDIO) < 0)
|
||||||
{
|
{
|
||||||
printf("SDL could not initialize!\nSDL Error: %s\n", SDL_GetError());
|
std::cout << "SDL could not initialize!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -645,14 +646,14 @@ bool Director::initSDL()
|
|||||||
// Establece el filtro de la textura a nearest
|
// Establece el filtro de la textura a nearest
|
||||||
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(options->filter).c_str()))
|
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(options->filter).c_str()))
|
||||||
{
|
{
|
||||||
printf("Warning: Nearest texture filtering not enabled!\n");
|
std::cout << "Warning: Nearest texture filtering not enabled!\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Crea la ventana
|
// Crea la ventana
|
||||||
window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, options->screenWidth, options->screenHeight, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI);
|
window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, options->screenWidth, options->screenHeight, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI);
|
||||||
if (window == nullptr)
|
if (window == nullptr)
|
||||||
{
|
{
|
||||||
printf("Window could not be created!\nSDL Error: %s\n", SDL_GetError());
|
std::cout << "Window could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -665,7 +666,7 @@ bool Director::initSDL()
|
|||||||
|
|
||||||
if (renderer == nullptr)
|
if (renderer == nullptr)
|
||||||
{
|
{
|
||||||
printf("Renderer could not be created!\nSDL Error: %s\n", SDL_GetError());
|
std::cout << "Renderer could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -682,7 +683,7 @@ bool Director::initSDL()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
std::cout << std::endl;
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -410,15 +410,10 @@ void Game::reLoadTextures()
|
|||||||
// Cambia la paleta
|
// Cambia la paleta
|
||||||
void Game::switchPalette()
|
void Game::switchPalette()
|
||||||
{
|
{
|
||||||
|
std::cout << "** PALETTE SWITCH REQUESTED" << std::endl;
|
||||||
|
|
||||||
// Modifica la variable
|
// Modifica la variable
|
||||||
if (options->palette == p_zxspectrum)
|
options->palette = (options->palette == p_zxspectrum) ? p_zxarne : p_zxspectrum;
|
||||||
{
|
|
||||||
options->palette = p_zxarne;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
options->palette = p_zxspectrum;
|
|
||||||
}
|
|
||||||
|
|
||||||
room->reLoadPalette();
|
room->reLoadPalette();
|
||||||
player->reLoadPalette();
|
player->reLoadPalette();
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ Empezado en Castalla el 01/07/2022.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "director.h"
|
#include "director.h"
|
||||||
#include <stdio.h>
|
#include <iostream>
|
||||||
|
|
||||||
int main(int argc, char *args[])
|
int main(int argc, char *args[])
|
||||||
{
|
{
|
||||||
printf("Starting the game...\n\n");
|
std::cout << "Starting the game...\n\n";
|
||||||
|
|
||||||
// Crea el objeto Director
|
// Crea el objeto Director
|
||||||
Director *director = new Director(args[0]);
|
Director *director = new Director(args[0]);
|
||||||
@@ -22,7 +22,7 @@ int main(int argc, char *args[])
|
|||||||
delete director;
|
delete director;
|
||||||
director = nullptr;
|
director = nullptr;
|
||||||
|
|
||||||
printf("\nShutting down the game...\n");
|
std::cout << "\nShutting down the game...\n";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -450,7 +450,6 @@ Room::Room(room_t *room, SDL_Renderer *renderer, Screen *screen, Asset *asset, o
|
|||||||
Room::~Room()
|
Room::~Room()
|
||||||
{
|
{
|
||||||
// Reclama la memoria utilizada por los objetos
|
// Reclama la memoria utilizada por los objetos
|
||||||
// delete texture;
|
|
||||||
JA_DeleteSound(itemSound);
|
JA_DeleteSound(itemSound);
|
||||||
SDL_DestroyTexture(mapTexture);
|
SDL_DestroyTexture(mapTexture);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user