linter
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
#include "logo.hpp"
|
||||
|
||||
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_PollEvent, SDL_Event, SDL_FRect
|
||||
#include <SDL3/SDL.h> // Para SDL_GetTicks, SDL_PollEvent, SDL_Event, SDL_FRect, Uint64
|
||||
|
||||
#include <cstddef> // Para size_t
|
||||
#include <string> // Para basic_string
|
||||
#include <utility> // Para move
|
||||
|
||||
#include "audio.hpp" // Para Audio
|
||||
#include "color.hpp" // Para Color
|
||||
#include "global_events.hpp" // Para check
|
||||
#include "global_events.hpp" // Para handle
|
||||
#include "global_inputs.hpp" // Para check
|
||||
#include "input.hpp" // Para Input
|
||||
#include "param.hpp" // Para Param, ParamGame, param
|
||||
@@ -118,16 +120,16 @@ void Logo::updateJAILGAMES(float delta_time) {
|
||||
void Logo::updateTextureColors(float delta_time) {
|
||||
// Manejo de 'sinceTexture'
|
||||
for (int i = 0; i <= MAX_SINCE_COLOR_INDEX; ++i) {
|
||||
const float target_time = SHOW_SINCE_SPRITE_TIME_S + COLOR_CHANGE_INTERVAL_S * i;
|
||||
if (elapsed_time_s_ >= target_time && elapsed_time_s_ - delta_time < target_time) {
|
||||
const float TARGET_TIME = SHOW_SINCE_SPRITE_TIME_S + (COLOR_CHANGE_INTERVAL_S * i);
|
||||
if (elapsed_time_s_ >= TARGET_TIME && elapsed_time_s_ - delta_time < TARGET_TIME) {
|
||||
since_texture_->setColor(color_[i].r, color_[i].g, color_[i].b);
|
||||
}
|
||||
}
|
||||
|
||||
// Manejo de 'jailTexture' y 'sinceTexture' en el fade
|
||||
for (int i = 0; i <= MAX_FADE_COLOR_INDEX; ++i) {
|
||||
const float target_time = INIT_FADE_TIME_S + COLOR_CHANGE_INTERVAL_S * i;
|
||||
if (elapsed_time_s_ >= target_time && elapsed_time_s_ - delta_time < target_time) {
|
||||
const float TARGET_TIME = INIT_FADE_TIME_S + (COLOR_CHANGE_INTERVAL_S * i);
|
||||
if (elapsed_time_s_ >= TARGET_TIME && elapsed_time_s_ - delta_time < TARGET_TIME) {
|
||||
jail_texture_->setColor(color_[MAX_FADE_COLOR_INDEX - i].r, color_[MAX_FADE_COLOR_INDEX - i].g, color_[MAX_FADE_COLOR_INDEX - i].b);
|
||||
since_texture_->setColor(color_[MAX_FADE_COLOR_INDEX - i].r, color_[MAX_FADE_COLOR_INDEX - i].g, color_[MAX_FADE_COLOR_INDEX - i].b);
|
||||
}
|
||||
@@ -160,11 +162,11 @@ void Logo::render() {
|
||||
}
|
||||
|
||||
// Calcula el tiempo transcurrido desde el último frame
|
||||
float Logo::calculateDeltaTime() {
|
||||
const Uint64 current_time = SDL_GetTicks();
|
||||
const float delta_time = static_cast<float>(current_time - last_time_) / 1000.0f; // Convertir ms a segundos
|
||||
last_time_ = current_time;
|
||||
return delta_time;
|
||||
auto Logo::calculateDeltaTime() -> float {
|
||||
const Uint64 CURRENT_TIME = SDL_GetTicks();
|
||||
const float DELTA_TIME = static_cast<float>(CURRENT_TIME - last_time_) / 1000.0F; // Convertir ms a segundos
|
||||
last_time_ = CURRENT_TIME;
|
||||
return DELTA_TIME;
|
||||
}
|
||||
|
||||
// Bucle para el logo del juego
|
||||
@@ -172,10 +174,10 @@ void Logo::run() {
|
||||
last_time_ = SDL_GetTicks();
|
||||
|
||||
while (Section::name == Section::Name::LOGO) {
|
||||
const float delta_time = calculateDeltaTime();
|
||||
const float DELTA_TIME = calculateDeltaTime();
|
||||
|
||||
checkInput();
|
||||
update(delta_time);
|
||||
update(DELTA_TIME);
|
||||
checkEvents(); // Tiene que ir antes del render
|
||||
render();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user