Skip to content

Commit 57dbfb3

Browse files
committed
rename WorldData in WorldResources
1 parent 4619bf3 commit 57dbfb3

File tree

14 files changed

+45
-227
lines changed

14 files changed

+45
-227
lines changed

games/HOME/bits/BackpackEntity.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ namespace home {
1919
constexpr int UnloadSpeed = 250'000;
2020
}
2121

22-
BackpackEntity::BackpackEntity(GameHub* hub, const WorldData& data)
22+
BackpackEntity::BackpackEntity(GameHub* hub, const WorldResources& resources)
2323
: m_hub(hub)
2424
, m_oxygen_quantity(MaxOxygen)
25-
, m_backpack_sprite(data.backpack_icon, hub->render_manager(), hub->resource_manager())
26-
, m_oxygen_sprite(data.oxygen_icon, hub->render_manager(), hub->resource_manager())
25+
, m_backpack_sprite(resources.backpack_icon, hub->render_manager(), hub->resource_manager())
26+
, m_oxygen_sprite(resources.oxygen_icon, hub->render_manager(), hub->resource_manager())
2727
{
2828

29-
const auto* rich_map = hub->resource_manager()->get<gf::RichMap>(data.map.filename);
29+
const auto* rich_map = hub->resource_manager()->get<gf::RichMap>(resources.map.filename);
3030
const gf::TiledMap* tiled_map = rich_map->tiled_map();
3131

3232
for (const auto& object_layer : tiled_map->object_layers) {

games/HOME/bits/BackpackEntity.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
#include <gf2/graphics/SpriteEntity.h>
99

1010
#include "SupplyType.h"
11-
#include "WorldData.h"
11+
#include "WorldResources.h"
1212

1313
namespace home {
1414

1515
class GameHub;
1616

1717
class BackpackEntity : public gf::Entity {
1818
public:
19-
BackpackEntity(GameHub* hub, const WorldData& data);
19+
BackpackEntity(GameHub* hub, const WorldResources& resources);
2020

2121
void set_hero_location(gf::Vec2F location);
2222

games/HOME/bits/GameHub.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ namespace home {
66
: gf::SceneSystem("H.O.M.E.", { 1600, 900 }, asset_directory)
77
, m_world_async(render_manager())
88
{
9-
auto splash_bundle = m_splash_data.bundle(this);
9+
auto splash_bundle = m_splash_resources.bundle(this);
1010
splash_bundle.load_from(resource_manager());
1111

12-
m_splash_scene = std::make_unique<SplashScene>(this, m_splash_data);
12+
m_splash_scene = std::make_unique<SplashScene>(this, m_splash_resources);
1313

1414
m_world_async.run_async([this]() {
15-
auto world_bundle = m_world_data.bundle(this);
15+
auto world_bundle = m_world_resources.bundle(this);
1616
world_bundle.load_from(resource_manager());
1717

18-
m_world_scene = std::make_unique<WorldScene>(this, m_world_data);
18+
m_world_scene = std::make_unique<WorldScene>(this, m_world_resources);
1919
});
2020

2121
push_scene(splash_scene());

games/HOME/bits/GameHub.h

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

1414
#include "SplashResources.h"
1515
#include "SplashScene.h"
16-
#include "WorldData.h"
16+
#include "WorldResources.h"
1717
#include "WorldScene.h"
1818

1919
namespace home {
@@ -35,11 +35,11 @@ namespace home {
3535
}
3636

3737
private:
38-
SplashResources m_splash_data;
38+
SplashResources m_splash_resources;
3939
std::unique_ptr<SplashScene> m_splash_scene = nullptr;
4040

4141
gf::RenderAsync m_world_async;
42-
WorldData m_world_data;
42+
WorldResources m_world_resources;
4343
std::unique_ptr<WorldScene> m_world_scene = nullptr;
4444
};
4545

games/HOME/bits/HeroEntity.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace home {
3535
return gf::Orientation::SouthWest;
3636
}
3737

38-
gf::Vec2F compute_initial_location(const WorldData& data, gf::ResourceManager* resource_manager)
38+
gf::Vec2F compute_initial_location(const WorldResources& data, gf::ResourceManager* resource_manager)
3939
{
4040
const gf::RichMap* map = resource_manager->get<gf::RichMap>(data.map.filename);
4141

@@ -57,16 +57,16 @@ namespace home {
5757

5858
using namespace gf::literals;
5959

60-
HeroEntity::HeroEntity(GameHub* hub, const WorldData& data, gf::PhysicsWorld* physics_world)
60+
HeroEntity::HeroEntity(GameHub* hub, const WorldResources& resources, gf::PhysicsWorld* physics_world)
6161
: m_controller(gf::PhysicsBody::make_kinematic())
6262
, m_body(gf::PhysicsBody::make_dynamic(HeroMass, gf::compute_moment_for_circle(HeroMass, 0.0f, HeroRadius, { 0.0f, 0.0f })))
6363
, m_pivot(gf::PhysicsConstraint::make_pivot_joint(&m_controller, &m_body, { 0.0f, 0.0f }, { 0.0f, 0.0f }))
6464
, m_gear(gf::PhysicsConstraint::make_gear_joint(&m_controller, &m_body, 0.0f, 1.0f))
6565
, m_shape(gf::PhysicsShape::make_circle(&m_body, HeroRadius, { 0.0f, 0.0f }))
66-
, m_target(compute_initial_location(data, hub->resource_manager()))
67-
, m_hero_animations(data.hero_animations, hub->render_manager(), hub->resource_manager())
68-
, m_crosshair(data.crosshair, hub->render_manager(), hub->resource_manager())
69-
, m_jet_engine_sound(hub->resource_manager()->get<gf::Sound>(data.jet_engine_sound.filename))
66+
, m_target(compute_initial_location(resources, hub->resource_manager()))
67+
, m_hero_animations(resources.hero_animations, hub->render_manager(), hub->resource_manager())
68+
, m_crosshair(resources.crosshair, hub->render_manager(), hub->resource_manager())
69+
, m_jet_engine_sound(hub->resource_manager()->get<gf::Sound>(resources.jet_engine_sound.filename))
7070
{
7171
set_location({ 0.0f, 0.0f });
7272
set_origin({ 0.5f, 0.5f });

games/HOME/bits/HeroEntity.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
#include <gf2/physics/PhysicsConstraint.h>
1414
#include <gf2/physics/PhysicsShape.h>
1515

16-
#include "WorldData.h"
16+
#include "WorldResources.h"
1717

1818
namespace home {
1919
class GameHub;
2020

2121
class HeroEntity : public gf::TransformableEntity {
2222
public:
23-
HeroEntity(GameHub* hub, const WorldData& data, gf::PhysicsWorld* physics_world);
23+
HeroEntity(GameHub* hub, const WorldResources& resources, gf::PhysicsWorld* physics_world);
2424

2525
void update(gf::Time time) override;
2626
void render(gf::RenderRecorder& recorder) override;

games/HOME/bits/MapEntity.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ namespace home {
6868

6969
}
7070

71-
MapEntity::MapEntity(GameHub* hub, const WorldData& data, gf::PhysicsWorld* physics_world)
72-
: m_map_renderer(data.map, hub->render_manager(), hub->resource_manager())
71+
MapEntity::MapEntity(GameHub* hub, const WorldResources& resources, gf::PhysicsWorld* physics_world)
72+
: m_map_renderer(resources.map, hub->render_manager(), hub->resource_manager())
7373
{
7474

7575
const gf::TiledMap* tiled_map = m_map_renderer.tiled_map();

games/HOME/bits/MapEntity.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
#include <gf2/graphics/RichMapRenderer.h>
66
#include <gf2/physics/PhysicsWorld.h>
77

8-
#include "WorldData.h"
8+
#include "WorldResources.h"
99

1010
namespace home {
1111
class GameHub;
1212

1313
class MapEntity : public gf::Entity {
1414
public:
15-
MapEntity(GameHub* hub, const WorldData& data, gf::PhysicsWorld* physics_world);
15+
MapEntity(GameHub* hub, const WorldResources& resources, gf::PhysicsWorld* physics_world);
1616

1717
void set_hero_location(gf::Vec2F location);
1818

games/HOME/bits/SupplyEntity.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ namespace home {
4242
{
4343
}
4444

45-
SupplyEntity::SupplyEntity(GameHub* hub, const WorldData& data)
45+
SupplyEntity::SupplyEntity(GameHub* hub, const WorldResources& resources)
4646
: m_hub(hub)
47-
, m_oxygen_sound(hub->resource_manager()->get<gf::Sound>(data.oxygen_sound.filename))
48-
, m_mining_sound(hub->resource_manager()->get<gf::Sound>(data.mining_sound.filename))
49-
, m_energy_sprite(data.energy_sprite, hub->render_manager(), hub->resource_manager())
50-
, m_metal_sprite(data.metal_sprite, hub->render_manager(), hub->resource_manager())
51-
, m_oxygen_sprite(data.oxygen_sprite, hub->render_manager(), hub->resource_manager())
47+
, m_oxygen_sound(hub->resource_manager()->get<gf::Sound>(resources.oxygen_sound.filename))
48+
, m_mining_sound(hub->resource_manager()->get<gf::Sound>(resources.mining_sound.filename))
49+
, m_energy_sprite(resources.energy_sprite, hub->render_manager(), hub->resource_manager())
50+
, m_metal_sprite(resources.metal_sprite, hub->render_manager(), hub->resource_manager())
51+
, m_oxygen_sprite(resources.oxygen_sprite, hub->render_manager(), hub->resource_manager())
5252
{
53-
const gf::RichMap* rich_map = hub->resource_manager()->get<gf::RichMap>(data.map.filename);
53+
const gf::RichMap* rich_map = hub->resource_manager()->get<gf::RichMap>(resources.map.filename);
5454
const gf::TiledMap* tiled_map = rich_map->tiled_map();
5555

5656
for (const auto& object_layer : tiled_map->object_layers) {

games/HOME/bits/SupplyEntity.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <gf2/graphics/SpriteEntity.h>
1313

1414
#include "SupplyType.h"
15-
#include "WorldData.h"
15+
#include "WorldResources.h"
1616

1717
namespace home {
1818
class GameHub;
@@ -28,7 +28,7 @@ namespace home {
2828

2929
class SupplyEntity : public gf::Entity {
3030
public:
31-
SupplyEntity(GameHub* hub, const WorldData& data);
31+
SupplyEntity(GameHub* hub, const WorldResources& resources);
3232

3333
void update(gf::Time time) override;
3434
void render(gf::RenderRecorder& recorder) override;

0 commit comments

Comments
 (0)