demo: Title no consumeix dt quan delega a demo_game (era doble tick, deixava la demo congelada a frame 0)
This commit is contained in:
@@ -853,36 +853,9 @@ void Title::applyOptions() {
|
|||||||
|
|
||||||
// Ejecuta un frame
|
// Ejecuta un frame
|
||||||
void Title::iterate() {
|
void Title::iterate() {
|
||||||
const float DELTA_TIME_S = DeltaTime::tick();
|
// Si el joc demo està actiu, NO consumim el dt aqui: el consumeix
|
||||||
|
// Game::iterate() en el seu propi tick(). Cridar-lo dues vegades per frame
|
||||||
// Si las instrucciones están activas, delega el frame
|
// deixaria a Game un dt ~0 i la demo no avancaria (ni jugador ni globus).
|
||||||
if (instructions_active_) {
|
|
||||||
instructions_->update(DELTA_TIME_S);
|
|
||||||
instructions_->render();
|
|
||||||
|
|
||||||
if (instructions_->hasFinished()) {
|
|
||||||
bool was_quit = instructions_->isQuitRequested();
|
|
||||||
delete instructions_;
|
|
||||||
instructions_ = nullptr;
|
|
||||||
instructions_active_ = false;
|
|
||||||
|
|
||||||
if (was_quit) {
|
|
||||||
section_->name = SECTION_PROG_QUIT;
|
|
||||||
} else if (instructions_mode_ == Instructions::Mode::AUTO) {
|
|
||||||
section_->name = SECTION_PROG_TITLE;
|
|
||||||
init();
|
|
||||||
demo_ = true;
|
|
||||||
} else {
|
|
||||||
section_->name = SECTION_PROG_TITLE;
|
|
||||||
section_->subsection = SUBSECTION_TITLE_3;
|
|
||||||
}
|
|
||||||
// Reset del rellotge per evitar un dt enorme al tornar al Title.
|
|
||||||
DeltaTime::reset();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Si el juego demo está activo, delega el frame
|
|
||||||
if (demo_game_active_) {
|
if (demo_game_active_) {
|
||||||
// El demo Game necesita section->name == SECTION_PROG_GAME para funcionar
|
// El demo Game necesita section->name == SECTION_PROG_GAME para funcionar
|
||||||
section_->name = SECTION_PROG_GAME;
|
section_->name = SECTION_PROG_GAME;
|
||||||
@@ -916,6 +889,35 @@ void Title::iterate() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const float DELTA_TIME_S = DeltaTime::tick();
|
||||||
|
|
||||||
|
// Si las instrucciones están activas, delega el frame
|
||||||
|
if (instructions_active_) {
|
||||||
|
instructions_->update(DELTA_TIME_S);
|
||||||
|
instructions_->render();
|
||||||
|
|
||||||
|
if (instructions_->hasFinished()) {
|
||||||
|
bool was_quit = instructions_->isQuitRequested();
|
||||||
|
delete instructions_;
|
||||||
|
instructions_ = nullptr;
|
||||||
|
instructions_active_ = false;
|
||||||
|
|
||||||
|
if (was_quit) {
|
||||||
|
section_->name = SECTION_PROG_QUIT;
|
||||||
|
} else if (instructions_mode_ == Instructions::Mode::AUTO) {
|
||||||
|
section_->name = SECTION_PROG_TITLE;
|
||||||
|
init();
|
||||||
|
demo_ = true;
|
||||||
|
} else {
|
||||||
|
section_->name = SECTION_PROG_TITLE;
|
||||||
|
section_->subsection = SUBSECTION_TITLE_3;
|
||||||
|
}
|
||||||
|
// Reset del rellotge per evitar un dt enorme al tornar al Title.
|
||||||
|
DeltaTime::reset();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Ejecución normal del título
|
// Ejecución normal del título
|
||||||
update(DELTA_TIME_S);
|
update(DELTA_TIME_S);
|
||||||
render();
|
render();
|
||||||
|
|||||||
Reference in New Issue
Block a user