mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 13:07:16 +00:00
replaced hooks_startmenu and hooks_mainmenu with a general hooks_display_dialog
This commit is contained in:
parent
ca9a025e45
commit
8f8fb8a217
@ -371,7 +371,10 @@ EX namespace dialog {
|
||||
valuex = dcenter - fwidth / 2 + leftwidth + innerwidth + dfsize/2;
|
||||
}
|
||||
|
||||
EX purehookset hooks_display_dialog;
|
||||
|
||||
EX void display() {
|
||||
callhooks(hooks_display_dialog);
|
||||
int N = items.size();
|
||||
dfsize = vid.fsize;
|
||||
#if ISMOBILE || ISPANDORA
|
||||
|
@ -7772,8 +7772,15 @@ EX vector< function<void()> > screens = { normalscreen };
|
||||
template<class T> void pushScreen(const T& x) { screens.push_back(x); }
|
||||
inline void popScreen() { if(isize(screens)>1) screens.pop_back(); }
|
||||
inline void popScreenAll() { while(isize(screens)>1) popScreen(); }
|
||||
typedef void (*cfunction)();
|
||||
#endif
|
||||
|
||||
EX cfunction current_screen_cfunction() {
|
||||
auto tgt = screens.back().target<cfunction>();
|
||||
if(!tgt) return nullptr;
|
||||
return *tgt;
|
||||
}
|
||||
|
||||
#if HDR
|
||||
namespace sm {
|
||||
static const int NORMAL = 1;
|
||||
|
@ -59,6 +59,12 @@ public:
|
||||
explicit operator bool() const noexcept {
|
||||
return ptr_ != nullptr;
|
||||
}
|
||||
|
||||
template<class T> T* target() {
|
||||
auto ptr = dynamic_cast<function_state<T, R, Args...>*> (ptr_);
|
||||
if(!ptr) return nullptr;
|
||||
return &ptr->t_;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace hr
|
||||
|
@ -206,8 +206,6 @@ EX void showOverview() {
|
||||
|
||||
// -- main menu --
|
||||
|
||||
EX purehookset hooks_mainmenu;
|
||||
|
||||
EX void showMainMenu() {
|
||||
gamescreen(2);
|
||||
|
||||
@ -259,8 +257,6 @@ EX void showMainMenu() {
|
||||
dialog::addItem("SHARE", 's'-96);
|
||||
#endif
|
||||
|
||||
callhooks(hooks_mainmenu);
|
||||
|
||||
if(!canmove) q = "review the scene";
|
||||
else if(turncount > 0) q = "continue game";
|
||||
else q = "play the game!";
|
||||
@ -643,8 +639,6 @@ EX bool showHalloween() {
|
||||
|
||||
int daily_mode;
|
||||
|
||||
EX purehookset hooks_startmenu;
|
||||
|
||||
EX void showStartMenu() {
|
||||
if(!daily_mode) {
|
||||
daily_mode = hrand(10) + 1;
|
||||
@ -743,8 +737,6 @@ EX void showStartMenu() {
|
||||
break;
|
||||
}
|
||||
|
||||
callhooks(hooks_startmenu);
|
||||
|
||||
if(have_current_settings()) {
|
||||
dialog::addBreak(100);
|
||||
dialog::addBigItem(XLAT1("use current/saved settings"), SDLK_ESCAPE);
|
||||
|
Loading…
Reference in New Issue
Block a user