bool FileSpecifier::WriteDialog(Typecode type, const char *prompt, const char *default_name) { again: WriteFileDialog d(*this, type, prompt, default_name); bool result = false; if (d.Run()) { if (d.GetFilename().empty()) { play_dialog_sound(DIALOG_ERROR_SOUND); goto again; } *this = d.GetPath(); if (!confirm_save_choice(*this)) { goto again; } result = true; } return result; }
void w_entry_point_selector::event(SDL_Event &e) { if (e.type == SDL_KEYDOWN) { if (e.key.keysym.sym == SDLK_LEFT || e.key.keysym.sym == SDLK_RIGHT) { size_t theNumberOfEntryPoints = mEntryPoints.size(); if(theNumberOfEntryPoints > 1) { int theDesiredOffset = (e.key.keysym.sym == SDLK_LEFT) ? -1 : 1; mCurrentIndex = (mCurrentIndex + theNumberOfEntryPoints + theDesiredOffset) % theNumberOfEntryPoints; mEntryPoint = mEntryPoints[mCurrentIndex]; dirty = true; play_dialog_sound(DIALOG_CLICK_SOUND); } e.type = SDL_LASTEVENT; // Swallow event } } }