iwyu
clang-tidy clang-format
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user