Continue arreglant cosetes amb cppcheck

This commit is contained in:
2024-10-24 20:36:30 +02:00
parent a5c72a0f65
commit 43e7b83403
80 changed files with 4830 additions and 3461 deletions

View File

@@ -1,24 +1,23 @@
#include "screen.h"
#include <SDL2/SDL_events.h> // for SDL_DISABLE, SDL_ENABLE
#include <SDL2/SDL_mouse.h> // for SDL_ShowCursor
#include <SDL2/SDL_pixels.h> // for SDL_PIXELFORMAT_RGBA8888
#include <SDL2/SDL_timer.h> // for SDL_GetTicks
#include <algorithm> // for max, min
#include <fstream> // for basic_ifstream, ifstream
#include <iterator> // for istreambuf_iterator, operator!=
#include <string> // for basic_string, operator+, to_string, cha...
#include <vector> // for vector
#include "asset.h" // for Asset
#include "dbgtxt.h" // for dbg_print
#include "global_inputs.h" // for servicePressedCounter
#include "input.h" // for Input, inputs_e, INPUT_DO_NOT_ALLOW_REPEAT
#include "notifier.h" // for Notify
#include "on_screen_help.h" // for OnScreenHelp
#include "options.h" // for options
#include "param.h" // for param
#include <SDL2/SDL_events.h> // para SDL_DISABLE, SDL_ENABLE
#include <SDL2/SDL_mouse.h> // para SDL_ShowCursor
#include <SDL2/SDL_pixels.h> // para SDL_PIXELFORMAT_RGBA8888
#include <SDL2/SDL_timer.h> // para SDL_GetTicks
#include <algorithm> // para max, min
#include <fstream> // para basic_ifstream, ifstream
#include <iterator> // para istreambuf_iterator, operator!=
#include <string> // para basic_string, operator+, to_string, cha...
#include <vector> // para vector
#include "asset.h" // para Asset
#include "dbgtxt.h" // para dbg_print
#include "global_inputs.h" // para servicePressedCounter
#include "input.h" // para Input, inputs_e, INPUT_DO_NOT_ALLOW_REPEAT
#include "notifier.h" // para Notify
#include "on_screen_help.h" // para OnScreenHelp
#include "options.h" // para options
#ifndef NO_SHADERS
#include "jail_shader.h" // for init, render
#include "jail_shader.h" // para init, render
#endif
// [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado
@@ -46,26 +45,12 @@ Screen *Screen::get()
Screen::Screen(SDL_Window *window, SDL_Renderer *renderer)
: window_(window),
renderer_(renderer),
game_canvas_(SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height)),
shader_canvas_(SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height)),
src_rect_({0, 0, param.game.width, param.game.height}),
dst_rect_({0, 0, param.game.width, param.game.height})
{
// Inicializa variables
flash_effect_.enabled = false;
flash_effect_.counter = 0;
flash_effect_.lenght = 0;
flash_effect_.color = Color(0xFF, 0xFF, 0xFF);
shake_effect_.enabled = false;
shake_effect_.desp = 2;
shake_effect_.delay = 3;
shake_effect_.counter = 0;
shake_effect_.lenght = 8;
shake_effect_.remaining = 0;
shake_effect_.originalPos = 0;
shake_effect_.originalWidth = param.game.width;
SDL_DisplayMode DM;
SDL_GetCurrentDisplayMode(0, &DM);
info_resolution_ = std::to_string(DM.w) + " X " + std::to_string(DM.h) + " AT " + std::to_string(DM.refresh_rate) + " HZ";