forked from jaildesigner-jailgames/jaildoctors_dilemma
opcions per amagar la pantalla de carrega
This commit is contained in:
@@ -438,7 +438,11 @@ auto Director::iterate() -> SDL_AppResult {
|
||||
// per veure la barra avançar suau i processar events del WM/ESC,
|
||||
// i evita el 50% d'ineficiència que provocaria un budget < vsync.
|
||||
if (Resource::Cache::get()->loadStep(50 /*ms*/)) {
|
||||
finishBoot();
|
||||
if (Options::loading.show && Options::loading.wait_for_input) {
|
||||
boot_waiting_for_input_ = true; // Esperar tecla antes de continuar
|
||||
} else {
|
||||
finishBoot();
|
||||
}
|
||||
boot_loading_ = false;
|
||||
// finishBoot() ja ha fixat SceneManager::current a LOGO (o la que
|
||||
// digui Debug). El canvi d'escena es fa just a sota.
|
||||
@@ -472,6 +476,17 @@ auto Director::handleEvent(const SDL_Event& event) -> SDL_AppResult {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Si estamos esperando input tras la carga: consumir tecla/botón y arrancar
|
||||
if (boot_waiting_for_input_) {
|
||||
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) {
|
||||
boot_waiting_for_input_ = false;
|
||||
finishBoot();
|
||||
}
|
||||
return SDL_APP_CONTINUE;
|
||||
}
|
||||
|
||||
if (active_scene_) {
|
||||
active_scene_->handleEvent(event);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,8 @@ class Director {
|
||||
|
||||
std::unique_ptr<Scene> active_scene_; // Escena activa
|
||||
SceneManager::Scene current_scene_{SceneManager::Scene::BOOT_LOADER}; // Tipus d'escena activa
|
||||
bool boot_loading_{true}; // True mientras Cache::loadStep() no haya acabado
|
||||
bool boot_loading_{true}; // True mientras Cache::loadStep() no haya acabado
|
||||
bool boot_waiting_for_input_{false}; // True si la carga acabó y Options::loading.wait_for_input está activo
|
||||
|
||||
// --- Funciones ---
|
||||
void createSystemFolder(const std::string& folder); // Crea la carpeta del sistema donde guardar datos
|
||||
|
||||
Reference in New Issue
Block a user