style: eliminats uns fprintf

This commit is contained in:
2025-03-16 13:24:33 +01:00
parent b3215bf381
commit bfb334bef0
4 changed files with 40 additions and 27 deletions

View File

@@ -144,7 +144,6 @@ void Credits::checkInput()
{
// Comprueba si se ha pulsado cualquier botón (de los usados para jugar)
if (Input::get()->checkAnyButtonPressed(INPUT_ALLOW_REPEAT))
{
if (mini_logo_on_position_)
{
@@ -163,6 +162,21 @@ void Credits::checkInput()
want_to_pass_ = false;
}
// Comprueba si se pulsa algun boton de disparo para acabar con el minilogo y empezar el fade
if (mini_logo_on_position_)
{
for (int i = 0; i < Input::get()->getNumControllers(); ++i)
{
// Salir
if (Input::get()->checkInput(InputType::FIRE_CENTER, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i) &&
Input::get()->checkInput(InputType::FIRE_LEFT, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i) &&
Input::get()->checkInput(InputType::FIRE_RIGHT, INPUT_DO_NOT_ALLOW_REPEAT, InputDeviceToUse::CONTROLLER, i))
{
fading_ = true;
}
}
}
// Comprueba los inputs que se pueden introducir en cualquier sección del juego
globalInputs::check();
}

View File

@@ -1,8 +1,8 @@
#include "gif.h"
#include <cstdio> // for fprintf, stderr
#include <cstring> // for memcpy, size_t
#include <stdexcept> // for runtime_error
#include <string> // for allocator, char_traits, operator==, basic_string
#include <iostream> // Para std::cout
#include <cstring> // Para memcpy, size_t
#include <stdexcept> // Para runtime_error
#include <string> // Para allocator, char_traits, operator==, basic_string
namespace GIF
{
@@ -52,7 +52,7 @@ namespace GIF
{
if (input_length <= 0)
{
throw std::runtime_error("Unexpected end of input in uncompress");
throw std::runtime_error("Unexpected end of input in decompress");
}
bit = ((*input & mask) != 0) ? 1 : 0;
mask <<= 1;
@@ -89,7 +89,8 @@ namespace GIF
{
if (code > dictionary_ind)
{
std::fprintf(stderr, "code = %.02x, but dictionary_ind = %d\n", code, dictionary_ind);
std::cerr << "code = " << std::hex << code
<< ", but dictionary_ind = " << dictionary_ind << std::endl;
throw std::runtime_error("LZW error: code exceeds dictionary_ind.");
}
@@ -124,7 +125,8 @@ namespace GIF
// Verifica que 'code' sea un índice válido antes de usarlo.
if (code < 0 || static_cast<size_t>(code) >= dictionary.size())
{
std::fprintf(stderr, "Invalid LZW code %d, dictionary size %zu\n", code, dictionary.size());
std::cerr << "Invalid LZW code " << code
<< ", dictionary size " << dictionary.size() << std::endl;
throw std::runtime_error("LZW error: invalid code encountered");
}
@@ -136,8 +138,8 @@ namespace GIF
out[dictionary[curCode].len - 1] = dictionary[curCode].byte;
if (dictionary[curCode].prev == curCode)
{
std::fprintf(stderr, "Internal error; self-reference detected.\n");
throw std::runtime_error("Internal error in uncompress: self-reference");
std::cerr << "Internal error; self-reference detected." << std::endl;
throw std::runtime_error("Internal error in decompress: self-reference");
}
curCode = dictionary[curCode].prev;
}
@@ -226,9 +228,6 @@ namespace GIF
w = screen_descriptor.width;
h = screen_descriptor.height;
// Imprime para depuración
std::fprintf(stderr, "Screen Descriptor - Width: %d, Height: %d\n", w, h);
int color_resolution_bits = ((screen_descriptor.fields & 0x70) >> 4) + 1;
std::vector<RGB> global_color_table;
if (screen_descriptor.fields & 0x80)
@@ -300,7 +299,7 @@ namespace GIF
}
else
{
std::fprintf(stderr, "Unrecognized block type %.02x\n", block_type);
std::cerr << "Unrecognized block type " << std::hex << static_cast<int>(block_type) << std::endl;
return std::vector<uint8_t>{};
}
block_type = *buffer++;

View File

@@ -1,7 +1,7 @@
#pragma once
#include <cstdint> // for uint8_t, uint16_t, uint32_t
#include <vector> // for vector
#include <cstdint> // Para uint8_t, uint16_t, uint32_t
#include <vector> // Para vector
namespace GIF
{

View File

@@ -1,15 +1,15 @@
#include "texture.h"
#include <SDL2/SDL_error.h> // for SDL_GetError
#include <SDL2/SDL_surface.h> // for SDL_CreateRGBSurfaceWithFormatFrom
#include <stdint.h> // for uint32_t
#include <cstring> // for memcpy, size_t
#include <fstream> // for basic_ostream, operator<<, basic_ifstream
#include <iostream> // for cerr, cout
#include <stdexcept> // for runtime_error
#include <string> // for char_traits, operator<<, operator+
#include <vector> // for vector
#include "gif.h" // for Gif
#include "utils.h" // for getFileName, Color, printWithDots
#include <SDL2/SDL_error.h> // Para SDL_GetError
#include <SDL2/SDL_surface.h> // Para SDL_CreateRGBSurfaceWithFormatFrom
#include <stdint.h> // Para uint32_t
#include <cstring> // Para memcpy, size_t
#include <fstream> // Para basic_ostream, operator<<, basic_ifstream
#include <iostream> // Para cerr, cout
#include <stdexcept> // Para runtime_error
#include <string> // Para char_traits, operator<<, operator+
#include <vector> // Para vector
#include "gif.h" // Para Gif
#include "utils.h" // Para getFileName, Color, printWithDots
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h" // Para stbi_failure_reason, stbi_image_free