fix: arreglada la acceleració dels credits sense dependre de vsync
This commit is contained in:
@@ -80,21 +80,27 @@ void Credits::run()
|
|||||||
// Actualiza las variables
|
// Actualiza las variables
|
||||||
void Credits::update()
|
void Credits::update()
|
||||||
{
|
{
|
||||||
if (SDL_GetTicks() - ticks_ > ticks_speed_)
|
constexpr Uint32 TICKS_SPEED_ = 15;
|
||||||
|
|
||||||
|
if (SDL_GetTicks() - ticks_ > TICKS_SPEED_)
|
||||||
{
|
{
|
||||||
ticks_ = SDL_GetTicks();
|
ticks_ = SDL_GetTicks();
|
||||||
tiled_bg_->update();
|
const int repeat = want_to_pass_ ? 4 : 1;
|
||||||
balloon_manager_->update();
|
for (int i = 0; i < repeat; ++i)
|
||||||
updateTextureDstRects();
|
|
||||||
throwBalloons();
|
|
||||||
for (auto &player : players_)
|
|
||||||
{
|
{
|
||||||
player->update();
|
tiled_bg_->update();
|
||||||
|
balloon_manager_->update();
|
||||||
|
updateTextureDstRects();
|
||||||
|
throwBalloons();
|
||||||
|
for (auto &player : players_)
|
||||||
|
{
|
||||||
|
player->update();
|
||||||
|
}
|
||||||
|
updateAllFades();
|
||||||
|
++counter_;
|
||||||
}
|
}
|
||||||
updateAllFades();
|
|
||||||
Screen::get()->update();
|
Screen::get()->update();
|
||||||
globalInputs::update();
|
globalInputs::update();
|
||||||
++counter_;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,7 +184,6 @@ void Credits::checkInput()
|
|||||||
{
|
{
|
||||||
// Si todavía estan los creditos en marcha, se pasan solos a toda pastilla
|
// Si todavía estan los creditos en marcha, se pasan solos a toda pastilla
|
||||||
want_to_pass_ = true;
|
want_to_pass_ = true;
|
||||||
ticks_speed_ = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ private:
|
|||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa
|
Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa
|
||||||
Uint32 ticks_speed_ = 15; // Velocidad del bucle update
|
|
||||||
Uint32 counter_ = 0; // Contador para la lógica de la clase
|
Uint32 counter_ = 0; // Contador para la lógica de la clase
|
||||||
Uint32 counter_pre_fade_ = 0; // Contador para activar el fundido final
|
Uint32 counter_pre_fade_ = 0; // Contador para activar el fundido final
|
||||||
Uint32 counter_prevent_endless_ = 0; // Contador para evitar que el juego se quede para siempre en los creditos
|
Uint32 counter_prevent_endless_ = 0; // Contador para evitar que el juego se quede para siempre en los creditos
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ Director::Director(int argc, const char *argv[])
|
|||||||
section::name = section::Name::GAME;
|
section::name = section::Name::GAME;
|
||||||
section::options = section::Options::GAME_PLAY_1P;
|
section::options = section::Options::GAME_PLAY_1P;
|
||||||
#elif DEBUG
|
#elif DEBUG
|
||||||
section::name = section::Name::GAME;
|
section::name = section::Name::CREDITS;
|
||||||
#else // NORMAL GAME
|
#else // NORMAL GAME
|
||||||
section::name = section::Name::LOGO;
|
section::name = section::Name::LOGO;
|
||||||
section::attract_mode = section::AttractMode::TITLE_TO_DEMO;
|
section::attract_mode = section::AttractMode::TITLE_TO_DEMO;
|
||||||
|
|||||||
Reference in New Issue
Block a user