Skip to content

Commit 4619bf3

Browse files
committed
move settings in WorldScene
1 parent 96396f1 commit 4619bf3

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

games/HOME/bits/WorldData.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ namespace home {
1515
{
1616
using namespace gf::literals;
1717

18-
action_group.actions.emplace("debug"_id, gf::ActionSettings(gf::ActionType::Instantaneous).add_keycode_control(gf::Keycode::P));
19-
2018
map.filename = "map/Map.tmx";
2119

2220
main_theme_music.filename = "sounds/main_theme.ogg";

games/HOME/bits/WorldData.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ namespace home {
1717

1818
gf::ResourceBundle bundle(GameHub* hub);
1919

20-
gf::ActionGroupSettings action_group;
21-
2220
gf::RichMapResource map;
2321

2422
gf::AudioSourceResource main_theme_music;

games/HOME/bits/WorldScene.cc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77

88
namespace home {
99

10-
using namespace gf::literals;
11-
1210
WorldScene::WorldScene(GameHub* hub, const WorldData& data)
1311
: m_hub(hub)
14-
, m_action_group(data.action_group)
12+
, m_action_group(compute_settings())
1513
, m_main_theme_music(hub->resource_manager()->get<gf::Music>(data.main_theme_music.filename))
1614
, m_breath_low_o2_sound(hub->resource_manager()->get<gf::Sound>(data.breath_low_o2_sound.filename))
1715
, m_victory_sound(hub->resource_manager()->get<gf::Sound>(data.victory_sound.filename))
@@ -51,6 +49,16 @@ namespace home {
5149
});
5250
}
5351

52+
gf::ActionGroupSettings WorldScene::compute_settings()
53+
{
54+
using namespace gf::literals;
55+
gf::ActionGroupSettings settings;
56+
57+
settings.actions.emplace("debug"_id, gf::ActionSettings(gf::ActionType::Instantaneous).add_keycode_control(gf::Keycode::P));
58+
59+
return settings;
60+
}
61+
5462
void WorldScene::do_update(gf::Time time)
5563
{
5664
update_entities(time);
@@ -69,6 +77,8 @@ namespace home {
6977

7078
void WorldScene::do_handle_actions()
7179
{
80+
using namespace gf::literals;
81+
7282
if (m_action_group.active("debug"_id)) {
7383
m_debug = !m_debug;
7484
m_physics_debug.set_awake(m_debug);

games/HOME/bits/WorldScene.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ namespace home {
3030
}
3131

3232
private:
33+
static gf::ActionGroupSettings compute_settings();
34+
3335
void do_update(gf::Time time) override;
3436
void do_process_event(const gf::Event& event) override;
3537
void do_handle_actions() override;

0 commit comments

Comments
 (0)