Compare commits
3 commits
4e64002574
...
480a087d8e
| Author | SHA1 | Date | |
|---|---|---|---|
| 480a087d8e | |||
| b5b8ba9498 | |||
| 986d2f17b6 |
3 changed files with 60 additions and 16 deletions
2
.gitmodules
vendored
2
.gitmodules
vendored
|
|
@ -1,3 +1,3 @@
|
|||
[submodule "psemek"]
|
||||
path = psemek
|
||||
url = git@bitbucket.org:lisyarus/psemek.git
|
||||
url = git@git.lisyarus.dev:lisyarus/psemek.git
|
||||
|
|
|
|||
2
psemek
2
psemek
|
|
@ -1 +1 @@
|
|||
Subproject commit 4890761b0ae5de23bbd4f28faefd41de423f6512
|
||||
Subproject commit b989eba66de743692532c5f0aace97be9f3a8041
|
||||
|
|
@ -1504,7 +1504,7 @@ namespace gmtk
|
|||
error_ = audio::load_mp3(io::read_full(std::move(*app::open_resource("sounds/error.mp3"))));
|
||||
|
||||
context_.windowed(is_windowed_);
|
||||
set_start_menu();
|
||||
init_menu();
|
||||
}
|
||||
|
||||
void on_event(app::resize_event const & event) override
|
||||
|
|
@ -1668,7 +1668,11 @@ namespace gmtk
|
|||
{
|
||||
item_killing_spree_ = false;
|
||||
|
||||
if (selected_button_)
|
||||
if (in_click_anywhere_menu_)
|
||||
{
|
||||
set_start_menu();
|
||||
}
|
||||
else if (selected_button_)
|
||||
{
|
||||
if (*selected_button_ < menu_buttons_.size() && menu_buttons_[*selected_button_].action)
|
||||
{
|
||||
|
|
@ -2548,7 +2552,11 @@ namespace gmtk
|
|||
|
||||
private:
|
||||
context const & context_;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
bool is_windowed_ = true;
|
||||
#else
|
||||
bool is_windowed_ = false;
|
||||
#endif
|
||||
|
||||
std::unique_ptr<audio::engine> audio_;
|
||||
audio::mixer_ptr mixer_;
|
||||
|
|
@ -2564,7 +2572,8 @@ namespace gmtk
|
|||
|
||||
bool running_ = true;
|
||||
|
||||
bool in_start_menu_ = true;
|
||||
bool in_click_anywhere_menu_ = false;
|
||||
bool in_start_menu_ = false;
|
||||
bool in_escape_menu_ = false;
|
||||
bool in_victory_menu_ = false;
|
||||
|
||||
|
|
@ -2582,7 +2591,7 @@ namespace gmtk
|
|||
|
||||
bool in_menu() const
|
||||
{
|
||||
return in_start_menu_ || in_escape_menu_ || in_victory_menu_;
|
||||
return in_click_anywhere_menu_ || in_start_menu_ || in_escape_menu_ || in_victory_menu_;
|
||||
}
|
||||
|
||||
std::uint64_t seed_ = 0;
|
||||
|
|
@ -2633,13 +2642,26 @@ namespace gmtk
|
|||
card_animation_.clear();
|
||||
}
|
||||
|
||||
void set_start_menu()
|
||||
void init_menu()
|
||||
{
|
||||
in_start_menu_ = true;
|
||||
map_ = start_menu_map();
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
set_click_anywhere_menu();
|
||||
#else
|
||||
set_start_menu();
|
||||
#endif
|
||||
}
|
||||
|
||||
void set_click_anywhere_menu()
|
||||
{
|
||||
in_click_anywhere_menu_ = true;
|
||||
in_start_menu_ = false;
|
||||
in_escape_menu_ = false;
|
||||
in_victory_menu_ = false;
|
||||
|
||||
map_ = start_menu_map();
|
||||
menu_buttons_.clear();
|
||||
menu_buttons_.push_back({"Click anywhere", {}});
|
||||
|
||||
if (!view_stack_.empty())
|
||||
{
|
||||
|
|
@ -2648,8 +2670,24 @@ namespace gmtk
|
|||
}
|
||||
view_stack_.push_back({-1, {0, 0}});
|
||||
view_stack_.push_back({0, {1, 1}});
|
||||
}
|
||||
|
||||
void set_start_menu()
|
||||
{
|
||||
in_click_anywhere_menu_ = false;
|
||||
in_start_menu_ = true;
|
||||
in_escape_menu_ = false;
|
||||
in_victory_menu_ = false;
|
||||
|
||||
set_start_menu_buttons();
|
||||
|
||||
if (!view_stack_.empty())
|
||||
{
|
||||
view_transition_ = {view_stack_.back()};
|
||||
view_stack_.clear();
|
||||
}
|
||||
view_stack_.push_back({-1, {0, 0}});
|
||||
view_stack_.push_back({0, {1, 1}});
|
||||
}
|
||||
|
||||
void set_start_menu_buttons()
|
||||
|
|
@ -2659,7 +2697,9 @@ namespace gmtk
|
|||
menu_buttons_.push_back({"Challenge mode", [this]{ start_new_game(true, false, true); }});
|
||||
menu_buttons_.push_back({"Sandbox mode", [this]{ start_new_game(true, true, true); }});
|
||||
menu_buttons_.push_back({is_windowed_ ? "Windowed" : "Fullscreen", [this]{ is_windowed_ ^= true; context_.windowed(is_windowed_); set_start_menu_buttons(); }});
|
||||
#ifndef __EMSCRIPTEN__
|
||||
menu_buttons_.push_back({"Exit", [this]{ stop(); }});
|
||||
#endif
|
||||
}
|
||||
|
||||
void set_escape_menu_buttons()
|
||||
|
|
@ -2675,7 +2715,9 @@ namespace gmtk
|
|||
}});
|
||||
menu_buttons_.push_back({"Main menu", [this]{ set_start_menu(); }});
|
||||
menu_buttons_.push_back({is_windowed_ ? "Windowed" : "Fullscreen", [this]{ is_windowed_ ^= true; context_.windowed(is_windowed_); set_escape_menu_buttons(); }});
|
||||
#ifndef __EMSCRIPTEN__
|
||||
menu_buttons_.push_back({"Exit", [this]{ stop(); }});
|
||||
#endif
|
||||
}
|
||||
|
||||
void set_victory_menu_buttons()
|
||||
|
|
@ -2685,7 +2727,9 @@ namespace gmtk
|
|||
menu_buttons_.push_back({"One more turn", [this]{ in_victory_menu_ = false; }});
|
||||
menu_buttons_.push_back({"Play again", [this]{ start_new_game(is_challenge_mode_, is_sandbox_mode_, true); }});
|
||||
menu_buttons_.push_back({"Main menu", [this]{ set_start_menu(); }});
|
||||
#ifndef __EMSCRIPTEN__
|
||||
menu_buttons_.push_back({"Exit", [this]{ stop(); }});
|
||||
#endif
|
||||
}
|
||||
|
||||
random::generator map_rng_;
|
||||
|
|
@ -2842,43 +2886,43 @@ namespace gmtk
|
|||
|
||||
void item_received_sound()
|
||||
{
|
||||
if (in_start_menu_) return;
|
||||
if (in_click_anywhere_menu_ || in_start_menu_) return;
|
||||
mixer_->add(audio::volume(click_high_->stream(), 0.25f));
|
||||
}
|
||||
|
||||
void item_produced_sound()
|
||||
{
|
||||
if (in_start_menu_) return;
|
||||
if (in_click_anywhere_menu_ || in_start_menu_) return;
|
||||
mixer_->add(audio::volume(click_low_->stream(), 0.5f));
|
||||
}
|
||||
|
||||
void mixer_sound()
|
||||
{
|
||||
if (in_start_menu_) return;
|
||||
if (in_click_anywhere_menu_ || in_start_menu_) return;
|
||||
mixer_->add(audio::volume(machine_->stream(), 0.125f));
|
||||
}
|
||||
|
||||
void shifter_sound()
|
||||
{
|
||||
if (in_start_menu_) return;
|
||||
if (in_click_anywhere_menu_ || in_start_menu_) return;
|
||||
mixer_->add(audio::volume(gears_->stream(), 0.5f));
|
||||
}
|
||||
|
||||
void reshaper_sound()
|
||||
{
|
||||
if (in_start_menu_) return;
|
||||
if (in_click_anywhere_menu_ || in_start_menu_) return;
|
||||
mixer_->add(audio::volume(key_click_->stream(), 0.25f));
|
||||
}
|
||||
|
||||
void item_removed_sound()
|
||||
{
|
||||
if (in_start_menu_) return;
|
||||
if (in_click_anywhere_menu_ || in_start_menu_) return;
|
||||
mixer_->add(audio::volume(pop_->stream(), 0.5f));
|
||||
}
|
||||
|
||||
void item_error_sound()
|
||||
{
|
||||
if (in_start_menu_) return;
|
||||
if (in_click_anywhere_menu_ || in_start_menu_) return;
|
||||
// mixer_->add(audio::volume(error_->stream(), 0.25f));
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue