Cambiados los printf por std::cout

This commit is contained in:
2022-12-07 09:12:30 +01:00
parent 6aebb28f37
commit 7adb049b37
2 changed files with 21 additions and 20 deletions

View File

@@ -589,13 +589,13 @@ bool Game::loadScoreFile()
// El fichero no existe
if (file == nullptr)
{
printf("Warning: Unable to open %s file\n", filename.c_str());
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << std::endl;
// Creamos el fichero para escritura
file = SDL_RWFromFile(p.c_str(), "w+b");
if (file != nullptr)
{
printf("New file (%s) created!\n", filename.c_str());
std::cout << "New file (" << filename.c_str() << ") created!" << std::endl;
// Inicializamos los datos
for (int i = 0; i < TOTAL_SCORE_DATA; ++i)
@@ -609,7 +609,7 @@ bool Game::loadScoreFile()
}
else
{
printf("Error: Unable to create file %s\n", filename.c_str());
std::cout << "Error: Unable to create file " << filename.c_str() << std::endl;
success = false;
}
}
@@ -617,7 +617,7 @@ bool Game::loadScoreFile()
else
{
// Cargamos los datos
printf("Reading file %s\n", filename.c_str());
std::cout << "Reading file " << filename.c_str() << std::endl;
for (int i = 0; i < TOTAL_SCORE_DATA; ++i)
SDL_RWread(file, &scoreDataFile[i], sizeof(Uint32), 1);
@@ -655,13 +655,13 @@ bool Game::loadDemoFile()
// El fichero no existe
if (file == nullptr)
{
printf("Warning: Unable to open %s file\n", filename.c_str());
std::cout << "Warning: Unable to open " << filename.c_str() << " file" << std::endl;
// Creamos el fichero para escritura
file = SDL_RWFromFile(p.c_str(), "w+b");
if (file != nullptr)
{
printf("New file (%s) created!\n", filename.c_str());
std::cout << "New file (" << filename.c_str() << ") created!" << std::endl;
// Inicializamos los datos
for (int i = 0; i < TOTAL_DEMO_DATA; ++i)
@@ -681,7 +681,7 @@ bool Game::loadDemoFile()
}
else
{
printf("Error: Unable to create file %s\n", filename.c_str());
std::cout << "Error: Unable to create file " << filename.c_str() << std::endl;
success = false;
}
}
@@ -689,7 +689,7 @@ bool Game::loadDemoFile()
else
{
// Cargamos los datos
printf("Reading file %s\n", filename.c_str());
std::cout << "Reading file " << filename.c_str() << std::endl;
for (int i = 0; i < TOTAL_DEMO_DATA; ++i)
SDL_RWread(file, &demo.dataFile[i], sizeof(demoKeys_t), 1);
@@ -715,14 +715,14 @@ bool Game::saveScoreFile()
SDL_RWwrite(file, &scoreDataFile[i], sizeof(Uint32), 1);
}
printf("Writing file %s\n", filename.c_str());
std::cout << "Writing file " << filename.c_str() << std::endl;
// Cerramos el fichero
SDL_RWclose(file);
}
else
{
printf("Error: Unable to save %s file! %s\n", filename.c_str(), SDL_GetError());
std::cout << "Error: Unable to save " << filename.c_str() << " file! " << SDL_GetError() << std::endl;
}
return success;
}
@@ -771,14 +771,14 @@ bool Game::saveDemoFile()
SDL_RWwrite(file, &demo.dataFile[i], sizeof(demoKeys_t), 1);
}
printf("Writing file %s\n", filename.c_str());
std::cout << "Writing file " << filename.c_str() << std::endl;
// Cerramos el fichero
SDL_RWclose(file);
}
else
{
printf("Error: Unable to save %s file! %s\n", filename.c_str(), SDL_GetError());
std::cout << "Error: Unable to save " << filename.c_str() << " file! " << SDL_GetError() << std::endl;
}
}
return success;
@@ -1806,7 +1806,7 @@ void Game::updateDeath()
{
// Hace sonar aleatoriamente uno de los 4 sonidos de burbujas
const Uint8 index = rand() % 4;
JA_Sound_t* sound[4] = {bubble1Sound, bubble2Sound, bubble3Sound, bubble4Sound};
JA_Sound_t *sound[4] = {bubble1Sound, bubble2Sound, bubble3Sound, bubble4Sound};
JA_PlaySound(sound[index], 0);
}
}