clang-tidy
clang-format
This commit is contained in:
2025-08-10 22:01:18 +02:00
parent 659a4ced44
commit 41e3fd1d8d
29 changed files with 235 additions and 302 deletions

View File

@@ -1,12 +1,11 @@
#include "game.h"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget, SDL_EventType, SDL_CreateTexture, SDL_Delay, SDL_DestroyTexture, SDL_Event, SDL_GetRenderTarget, SDL_PollEvent, SDL_RenderTexture, SDL_SetTextureBlendMode, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, SDLK_6, SDLK_7, SDLK_8, SDLK_9, SDLK_KP_MINUS, SDLK_KP_PLUS, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_Point, SDL_TextureAccess
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderTarget, SDL_CreateTexture, SDL_Delay, SDL_DestroyTexture, SDL_EventType, SDL_GetRenderTarget, SDL_PollEvent, SDL_RenderTexture, SDL_SetTextureBlendMode, SDL_BLENDMODE_BLEND, SDL_Event, SDL_PixelFormat, SDL_Point, SDL_TextureAccess
#include <algorithm> // Para max, find, clamp, find_if, min
#include <algorithm> // Para find, clamp, find_if, min
#include <array> // Para array
#include <cstdlib> // Para rand, size_t
#include <functional> // Para function
#include <iostream> // Para basic_ostream, basic_ostream::operator<<, cout, endl
#include <iterator> // Para size
#include <memory> // Para shared_ptr, unique_ptr, __shared_ptr_access, allocator, make_unique, operator==, make_shared
#include <utility> // Para move
@@ -37,12 +36,16 @@
#include "screen.h" // Para Screen
#include "section.hpp" // Para Name, name, AttractMode, Options, attract_mode, options
#include "smart_sprite.h" // Para SmartSprite
#include "stage.h" // Para number, Stage, get, total_power, power, addPower, init, power_can_be_added, stages
#include "stage.h" // Para number, Stage, get, total_power, power, init, power_can_be_added, stages
#include "tabe.h" // Para Tabe
#include "text.h" // Para Text
#include "texture.h" // Para Texture
#include "ui/notifier.h" // Para Notifier
#include "ui/service_menu.h" // Para ServiceMenu
#ifdef _DEBUG
#include <iostream> // Para Notifier
#include "ui/notifier.h" // Para Notifier
#endif
// Constructor
Game::Game(Player::Id player_id, int current_stage, bool demo)

View File

@@ -1,18 +1,16 @@
#pragma once
#include <SDL3/SDL.h> // Para SDL_Event, SDL_Renderer, SDL_Texture, Uint64, Uint8
#include <SDL3/SDL.h> // Para SDL_Renderer, SDL_Texture, Uint64, Uint8
#include <memory> // Para shared_ptr, unique_ptr
#include <set> // Para Set
#include <string> // Para string
#include <vector> // Para vector
#include "hit.h" // Para Hit
#include "item.h" // Para Item, ItemType
#include "manage_hiscore_table.h" // Para HiScoreEntry
#include "options.h" // Para SettingsOptions, settings
#include "options.h" // Para Settings, settings
#include "path_sprite.h" // Para PathSprite, Path
#include "pause_manager.h" // Para PauseManager
#include "player.h" // Para Player
#include "smart_sprite.h" // Para SmartSprite
#include "utils.h" // Para Demo
@@ -23,11 +21,13 @@ class BalloonManager;
class Bullet;
class Fade;
class Input;
class PauseManager;
class Scoreboard;
class Screen;
class Tabe;
class Texture;
enum class BulletType : Uint8;
namespace Difficulty {
enum class Code;
} // namespace Difficulty

View File

@@ -1,16 +1,15 @@
#include "intro.h"
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderDrawColor, SDL_FRect, SDL_RenderFillRect, SDL_GetRenderTarget, SDL_RenderClear, SDL_RenderRect, SDL_SetRenderTarget, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_PollEvent, SDL_RenderTexture, SDL_TextureAccess, SDLK_A, SDLK_C, SDLK_D, SDLK_F, SDLK_S, SDLK_V, SDLK_X, SDLK_Z, SDL_Event, SDL_EventType, Uint32
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_SetRenderDrawColor, SDL_FRect, SDL_RenderFillRect, SDL_GetRenderTarget, SDL_RenderClear, SDL_RenderRect, SDL_SetRenderTarget, SDL_BLENDMODE_BLEND, SDL_PixelFormat, SDL_PollEvent, SDL_RenderTexture, SDL_TextureAccess, SDL_Event, Uint32
#include <algorithm> // Para max
#include <array> // Para array
#include <functional> // Para function
#include <iostream> // Para basic_ostream, basic_ostream::operator<<, operator<<, cout, endl, hex
#include <string> // Para char_traits, basic_string, string
#include <string> // Para basic_string, string
#include <utility> // Para move
#include "audio.h" // Para Audio
#include "color.h" // Para Color, Zone, easeInOutExpo, easeInElastic, easeOutBounce, easeOutElastic, easeOutQuad, easeOutQuint
#include "color.h" // Para Color
#include "global_events.h" // Para check
#include "global_inputs.h" // Para check
#include "input.h" // Para Input
@@ -23,12 +22,8 @@
#include "text.h" // Para Text
#include "texture.h" // Para Texture
#include "tiled_bg.h" // Para TiledBG, TiledBGMode
#include "utils.h"
#include "writer.h" // Para Writer
#ifdef _DEBUG
#include <iomanip> // Para operator<<, setfill, setw
#endif
#include "utils.h" // Para Zone, easeInOutExpo, easeInElastic, easeOutBounce, easeOutElastic, easeOutQuad, easeOutQuint
#include "writer.h" // Para Writer
// Constructor
Intro::Intro()
@@ -52,14 +47,6 @@ Intro::Intro()
void Intro::checkEvents() {
SDL_Event event;
while (SDL_PollEvent(&event)) {
#ifdef _DEBUG
if (event.type == SDL_EVENT_KEY_DOWN && static_cast<int>(event.key.repeat) == 1) {
static Color color_ = param.intro.bg_color;
handleDebugColorKeys(event.key.key, color_);
tiled_bg_->setColor(color_);
printColorDebugInfo(color_);
}
#endif
GlobalEvents::check(event);
}
}
@@ -530,60 +517,4 @@ void Intro::renderTextRect() {
static SDL_FRect rect_ = {0.0F, param.game.height - param.intro.text_distance_from_bottom - HEIGHT, param.game.width, HEIGHT * 3};
SDL_SetRenderDrawColor(Screen::get()->getRenderer(), param.intro.shadow_color.r, param.intro.shadow_color.g, param.intro.shadow_color.b, param.intro.shadow_color.a);
SDL_RenderFillRect(Screen::get()->getRenderer(), &rect_);
}
#ifdef _DEBUG
// Helper functions for color adjustment
void Intro::adjustColorComponent(uint8_t &component, bool increase) {
if (increase && component < 255) {
++component;
} else if (!increase && component > 0) {
--component;
}
}
void Intro::adjustAllColorComponents(Color &color, bool increase) {
adjustColorComponent(color.r, increase);
adjustColorComponent(color.g, increase);
adjustColorComponent(color.b, increase);
}
void Intro::handleDebugColorKeys(SDL_Keycode key, Color &color) {
switch (key) {
case SDLK_A:
adjustColorComponent(color.r, true);
break;
case SDLK_Z:
adjustColorComponent(color.r, false);
break;
case SDLK_S:
adjustColorComponent(color.g, true);
break;
case SDLK_X:
adjustColorComponent(color.g, false);
break;
case SDLK_D:
adjustColorComponent(color.b, true);
break;
case SDLK_C:
adjustColorComponent(color.b, false);
break;
case SDLK_F:
adjustAllColorComponents(color, true);
break;
case SDLK_V:
adjustAllColorComponents(color, false);
break;
default:
break;
}
}
void Intro::printColorDebugInfo(const Color &color) {
std::cout << "#"
<< std::hex << std::setw(2) << std::setfill('0') << (int)color.r
<< std::setw(2) << std::setfill('0') << (int)color.g
<< std::setw(2) << std::setfill('0') << (int)color.b
<< std::endl;
}
#endif
}

View File

@@ -1,10 +1,9 @@
#pragma once
#include <SDL3/SDL.h> // Para SDL_Keycode, Uint32, Uint64
#include <SDL3/SDL.h> // Para Uint32, Uint64
#include <cstdint> // Para uint8_t
#include <memory> // Para unique_ptr
#include <vector> // Para vector
#include <memory> // Para unique_ptr
#include <vector> // Para vector
#include "color.h" // Para Color
#include "param.h" // Para Param, ParamIntro, param
@@ -57,8 +56,8 @@ class Intro {
// --- Métodos internos ---
void update(); // Actualiza las variables del objeto
void render(); // Dibuja el objeto en pantalla
void checkEvents(); // Comprueba los eventos
static void checkInput(); // Comprueba las entradas
static void checkEvents(); // Comprueba los eventos
void updateScenes(); // Actualiza las escenas de la intro
void initSprites(); // Inicializa las imágenes
void initTexts(); // Inicializa los textos
@@ -68,12 +67,6 @@ class Intro {
void renderTexts(); // Dibuja los textos
static void renderTextRect(); // Dibuja el rectangulo de fondo del texto;
void updatePostState(); // Actualiza el estado POST
#ifdef _DEBUG
static void adjustColorComponent(uint8_t& component, bool increase);
static void adjustAllColorComponents(Color& color, bool increase);
static void handleDebugColorKeys(SDL_Keycode key, Color& color);
static void printColorDebugInfo(const Color& color);
#endif
// --- Métodos para manejar cada escena individualmente ---
void updateScene0();

View File

@@ -2,11 +2,10 @@
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_PollEvent, SDL_Event, SDL_FRect
#include <algorithm> // Para max
#include <utility> // Para move
#include <utility> // Para move
#include "audio.h" // Para Audio
#include "color.h" // Para Color, Zone
#include "color.h" // Para Color
#include "global_events.h" // Para check
#include "global_inputs.h" // Para check
#include "input.h" // Para Input
@@ -16,7 +15,7 @@
#include "section.hpp" // Para Name, name
#include "sprite.h" // Para Sprite
#include "texture.h" // Para Texture
#include "utils.h"
#include "utils.h" // Para Zone
// Constructor
Logo::Logo()

View File

@@ -1,15 +1,13 @@
#include "title.h"
#include <SDL3/SDL.h> // Para SDL_GetTicks, Uint32, SDL_Keycode, SDL_Event, SDL_PollEvent, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, SDLK_A, SDLK_C, SDLK_D, SDLK_F, SDLK_S, SDLK_V, SDLK_X, SDLK_Z, SDL_EventType
#include <SDL3/SDL.h> // Para SDL_GetTicks, Uint32, SDL_Event, SDL_PollEvent, SDL_EventType
#include <algorithm> // Para max, find_if
#include <iostream> // Para basic_ostream, basic_ostream::operator<<, operator<<, cout, endl, hex
#include <string> // Para char_traits, operator+, to_string, string, basic_string
#include <string> // Para operator+, char_traits, to_string, string, basic_string
#include <vector> // Para vector
#include "audio.h" // Para Audio
#include "color.h" // Para Color, NO_TEXT_COLOR, TITLE_SHADOW_TEXT_COLOR
#include "define_buttons.h" // Para DefineButtons
#include "color.h" // Para NO_TEXT_COLOR, TITLE_SHADOW_TEXT_COLOR
#include "fade.h" // Para Fade, FadeType
#include "game_logo.h" // Para GameLogo
#include "global_events.h" // Para check
@@ -17,14 +15,14 @@
#include "input.h" // Para Input
#include "input_types.h" // Para InputAction
#include "lang.h" // Para getText
#include "options.h" // Para Gamepad, GamepadManager, gamepad_manager, Settings, settings, getPlayerWhoUsesKeyboard, swapControllers, swapKeyboard
#include "options.h" // Para Gamepad, GamepadManager, gamepad_manager, Settings, settings, Keyboard, keyboard, getPlayerWhoUsesKeyboard, swapControllers, swapKeyboard
#include "param.h" // Para Param, param, ParamGame, ParamTitle, ParamFade
#include "player.h" // Para Player
#include "resource.h" // Para Resource
#include "screen.h" // Para Screen
#include "section.hpp" // Para Name, name, Options, options, AttractMode, attract_mode
#include "sprite.h" // Para Sprite
#include "text.h" // Para Text::CENTER, Text::SHADOW, Text
#include "text.h" // Para Text
#include "tiled_bg.h" // Para TiledBG, TiledBGMode
#include "ui/notifier.h" // Para Notifier
#include "ui/service_menu.h" // Para ServiceMenu
@@ -34,6 +32,7 @@ class Texture;
#ifdef _DEBUG
#include <iomanip> // Para operator<<, setfill, setw
#include <iostream>
#endif
// Constructor

View File

@@ -1,9 +1,8 @@
#pragma once
#include <SDL3/SDL.h> // Para SDL_Keycode, SDL_Event, Uint64
#include <SDL3/SDL.h> // Para SDL_Event, Uint64
#include <cstdint> // Para uint8_t
#include <memory> // Para unique_ptr, shared_ptr
#include <memory> // Para shared_ptr, unique_ptr
#include <string_view> // Para string_view
#include <vector> // Para vector
@@ -15,10 +14,10 @@ class GameLogo;
class Sprite;
class Text;
class TiledBG;
namespace Options {
struct Gamepad;
} // namespace Options
struct Color;
// Textos
constexpr std::string_view TEXT_COPYRIGHT = "@2020,2025 JailDesigner";