Compare commits
No commits in common. "480a087d8e258e540aec198e701a5bfc1ed012fd" and "4e640025749b7a6c0676bde1201b84961e78c46a" have entirely different histories.
480a087d8e
...
4e64002574
3 changed files with 16 additions and 60 deletions
2
.gitmodules
vendored
2
.gitmodules
vendored
|
|
@ -1,3 +1,3 @@
|
|||
[submodule "psemek"]
|
||||
path = psemek
|
||||
url = git@git.lisyarus.dev:lisyarus/psemek.git
|
||||
url = git@bitbucket.org:lisyarus/psemek.git
|
||||
|
|
|
|||
2
psemek
2
psemek
|
|
@ -1 +1 @@
|
|||
Subproject commit b989eba66de743692532c5f0aace97be9f3a8041
|
||||
Subproject commit 4890761b0ae5de23bbd4f28faefd41de423f6512
|
||||
|
|
@ -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_);
|
||||
init_menu();
|
||||
set_start_menu();
|
||||
}
|
||||
|
||||
void on_event(app::resize_event const & event) override
|
||||
|
|
@ -1668,11 +1668,7 @@ namespace gmtk
|
|||
{
|
||||
item_killing_spree_ = false;
|
||||
|
||||
if (in_click_anywhere_menu_)
|
||||
{
|
||||
set_start_menu();
|
||||
}
|
||||
else if (selected_button_)
|
||||
if (selected_button_)
|
||||
{
|
||||
if (*selected_button_ < menu_buttons_.size() && menu_buttons_[*selected_button_].action)
|
||||
{
|
||||
|
|
@ -2552,11 +2548,7 @@ 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_;
|
||||
|
|
@ -2572,8 +2564,7 @@ namespace gmtk
|
|||
|
||||
bool running_ = true;
|
||||
|
||||
bool in_click_anywhere_menu_ = false;
|
||||
bool in_start_menu_ = false;
|
||||
bool in_start_menu_ = true;
|
||||
bool in_escape_menu_ = false;
|
||||
bool in_victory_menu_ = false;
|
||||
|
||||
|
|
@ -2591,7 +2582,7 @@ namespace gmtk
|
|||
|
||||
bool in_menu() const
|
||||
{
|
||||
return in_click_anywhere_menu_ || in_start_menu_ || in_escape_menu_ || in_victory_menu_;
|
||||
return in_start_menu_ || in_escape_menu_ || in_victory_menu_;
|
||||
}
|
||||
|
||||
std::uint64_t seed_ = 0;
|
||||
|
|
@ -2642,44 +2633,13 @@ namespace gmtk
|
|||
card_animation_.clear();
|
||||
}
|
||||
|
||||
void init_menu()
|
||||
{
|
||||
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;
|
||||
|
||||
menu_buttons_.clear();
|
||||
menu_buttons_.push_back({"Click anywhere", {}});
|
||||
|
||||
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()
|
||||
{
|
||||
in_click_anywhere_menu_ = false;
|
||||
in_start_menu_ = true;
|
||||
in_escape_menu_ = false;
|
||||
in_victory_menu_ = false;
|
||||
|
||||
set_start_menu_buttons();
|
||||
map_ = start_menu_map();
|
||||
|
||||
if (!view_stack_.empty())
|
||||
{
|
||||
|
|
@ -2688,6 +2648,8 @@ namespace gmtk
|
|||
}
|
||||
view_stack_.push_back({-1, {0, 0}});
|
||||
view_stack_.push_back({0, {1, 1}});
|
||||
|
||||
set_start_menu_buttons();
|
||||
}
|
||||
|
||||
void set_start_menu_buttons()
|
||||
|
|
@ -2697,9 +2659,7 @@ 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()
|
||||
|
|
@ -2715,9 +2675,7 @@ 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()
|
||||
|
|
@ -2727,9 +2685,7 @@ 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_;
|
||||
|
|
@ -2886,43 +2842,43 @@ namespace gmtk
|
|||
|
||||
void item_received_sound()
|
||||
{
|
||||
if (in_click_anywhere_menu_ || in_start_menu_) return;
|
||||
if (in_start_menu_) return;
|
||||
mixer_->add(audio::volume(click_high_->stream(), 0.25f));
|
||||
}
|
||||
|
||||
void item_produced_sound()
|
||||
{
|
||||
if (in_click_anywhere_menu_ || in_start_menu_) return;
|
||||
if (in_start_menu_) return;
|
||||
mixer_->add(audio::volume(click_low_->stream(), 0.5f));
|
||||
}
|
||||
|
||||
void mixer_sound()
|
||||
{
|
||||
if (in_click_anywhere_menu_ || in_start_menu_) return;
|
||||
if (in_start_menu_) return;
|
||||
mixer_->add(audio::volume(machine_->stream(), 0.125f));
|
||||
}
|
||||
|
||||
void shifter_sound()
|
||||
{
|
||||
if (in_click_anywhere_menu_ || in_start_menu_) return;
|
||||
if (in_start_menu_) return;
|
||||
mixer_->add(audio::volume(gears_->stream(), 0.5f));
|
||||
}
|
||||
|
||||
void reshaper_sound()
|
||||
{
|
||||
if (in_click_anywhere_menu_ || in_start_menu_) return;
|
||||
if (in_start_menu_) return;
|
||||
mixer_->add(audio::volume(key_click_->stream(), 0.25f));
|
||||
}
|
||||
|
||||
void item_removed_sound()
|
||||
{
|
||||
if (in_click_anywhere_menu_ || in_start_menu_) return;
|
||||
if (in_start_menu_) return;
|
||||
mixer_->add(audio::volume(pop_->stream(), 0.5f));
|
||||
}
|
||||
|
||||
void item_error_sound()
|
||||
{
|
||||
if (in_click_anywhere_menu_ || in_start_menu_) return;
|
||||
if (in_start_menu_) return;
|
||||
// mixer_->add(audio::volume(error_->stream(), 0.25f));
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue