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)
|
||||
{
|
||||
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();
|
||||
@@ -198,8 +198,8 @@ bool Input::discoverGameController()
|
||||
}
|
||||
}
|
||||
|
||||
printf("\nChecking for game controllers...\n");
|
||||
printf("%i joysticks found, %i are gamepads\n", nJoysticks, numGamepads);
|
||||
std::cout << "\nChecking for game controllers...\n";
|
||||
std::cout << nJoysticks << " joysticks found, " << numGamepads << " are gamepads\n";
|
||||
|
||||
if (numGamepads > 0)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "screen.h"
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
|
||||
// Constructor
|
||||
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);
|
||||
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
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "credits.h"
|
||||
#include <iostream>
|
||||
|
||||
// Constructor
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -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);
|
||||
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);
|
||||
|
||||
@@ -271,7 +272,7 @@ void Credits::render()
|
||||
screen->clean();
|
||||
|
||||
if (counter < 1150)
|
||||
{
|
||||
{
|
||||
// Dibuja la textura con el texto en pantalla
|
||||
SDL_RenderCopy(renderer, textTexture, nullptr, nullptr);
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ bool Director::loadConfig()
|
||||
if (file.good())
|
||||
{
|
||||
// Procesa el fichero linea a linea
|
||||
printf("Reading file config.txt\n");
|
||||
std::cout << "Reading file config.txt\n";
|
||||
while (std::getline(file, line))
|
||||
{
|
||||
// Comprueba que la linea no sea un comentario
|
||||
@@ -96,14 +96,15 @@ bool Director::loadConfig()
|
||||
// Procesa las dos subcadenas
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cierra el fichero
|
||||
printf("Closing file config.txt\n\n");
|
||||
std::cout << "Closing file config.txt\n\n";
|
||||
file.close();
|
||||
}
|
||||
|
||||
@@ -634,7 +635,7 @@ bool Director::initSDL()
|
||||
// Inicializa SDL
|
||||
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;
|
||||
}
|
||||
else
|
||||
@@ -645,14 +646,14 @@ bool Director::initSDL()
|
||||
// Establece el filtro de la textura a nearest
|
||||
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
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
else
|
||||
@@ -665,7 +666,7 @@ bool Director::initSDL()
|
||||
|
||||
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;
|
||||
}
|
||||
else
|
||||
@@ -682,7 +683,7 @@ bool Director::initSDL()
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
std::cout << std::endl;
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ void Game::checkEventHandler()
|
||||
screen->setBorderColor(stringToColor(options->palette, "black"));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ((eventHandler->type == SDL_KEYDOWN) and (eventHandler->key.repeat == 0))
|
||||
{
|
||||
switch (eventHandler->key.keysym.scancode)
|
||||
@@ -410,15 +410,10 @@ void Game::reLoadTextures()
|
||||
// Cambia la paleta
|
||||
void Game::switchPalette()
|
||||
{
|
||||
std::cout << "** PALETTE SWITCH REQUESTED" << std::endl;
|
||||
|
||||
// Modifica la variable
|
||||
if (options->palette == p_zxspectrum)
|
||||
{
|
||||
options->palette = p_zxarne;
|
||||
}
|
||||
else
|
||||
{
|
||||
options->palette = p_zxspectrum;
|
||||
}
|
||||
options->palette = (options->palette == p_zxspectrum) ? p_zxarne : p_zxspectrum;
|
||||
|
||||
room->reLoadPalette();
|
||||
player->reLoadPalette();
|
||||
|
||||
@@ -6,11 +6,11 @@ Empezado en Castalla el 01/07/2022.
|
||||
*/
|
||||
|
||||
#include "director.h"
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char *args[])
|
||||
{
|
||||
printf("Starting the game...\n\n");
|
||||
std::cout << "Starting the game...\n\n";
|
||||
|
||||
// Crea el objeto Director
|
||||
Director *director = new Director(args[0]);
|
||||
@@ -22,7 +22,7 @@ int main(int argc, char *args[])
|
||||
delete director;
|
||||
director = nullptr;
|
||||
|
||||
printf("\nShutting down the game...\n");
|
||||
std::cout << "\nShutting down the game...\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -450,7 +450,6 @@ Room::Room(room_t *room, SDL_Renderer *renderer, Screen *screen, Asset *asset, o
|
||||
Room::~Room()
|
||||
{
|
||||
// Reclama la memoria utilizada por los objetos
|
||||
// delete texture;
|
||||
JA_DeleteSound(itemSound);
|
||||
SDL_DestroyTexture(mapTexture);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user