27 lines
1.0 KiB
C++
27 lines
1.0 KiB
C++
#include "game/scenes/preload.hpp"
|
|
|
|
#include "core/resources/resource.hpp" // Para Resource
|
|
#include "core/system/section.hpp" // Para Section
|
|
#include "game/options.hpp" // Para Options::loading
|
|
|
|
void Preload::iterate() {
|
|
// El repintado es independiente del avance de la carga: Director::iterate
|
|
// ya ha bombeado Resource::loadStep() antes de llamar aquí.
|
|
Resource::get()->renderProgress();
|
|
}
|
|
|
|
void Preload::handleEvent(const SDL_Event& event) {
|
|
// Solo aceptamos input si la carga ha terminado y estamos en modo
|
|
// wait_for_input (que además exige que la pantalla de carga sea visible).
|
|
if (!Resource::get()->isLoadDone() || !Options::loading.wait_for_input || !Options::loading.show) {
|
|
return;
|
|
}
|
|
|
|
// Pulsación limpia: ignoramos auto-repeat y eventos de hotplug de mando.
|
|
const bool IS_KEY = event.type == SDL_EVENT_KEY_DOWN && !event.key.repeat;
|
|
const bool IS_BUTTON = event.type == SDL_EVENT_GAMEPAD_BUTTON_DOWN;
|
|
if (IS_KEY || IS_BUTTON) {
|
|
Section::name = Section::post_preload;
|
|
}
|
|
}
|