summary refs log tree commit diff stats
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp27
1 files changed, 3 insertions, 24 deletions
diff --git a/src/game.cpp b/src/game.cpp index 228ff23..f245e7c 100644 --- a/src/game.cpp +++ b/src/game.cpp
@@ -9,6 +9,7 @@
9#include "systems/animating.h" 9#include "systems/animating.h"
10#include "systems/mapping.h" 10#include "systems/mapping.h"
11#include "systems/orienting.h" 11#include "systems/orienting.h"
12#include "systems/playing.h"
12#include "animation.h" 13#include "animation.h"
13#include "consts.h" 14#include "consts.h"
14 15
@@ -28,36 +29,14 @@ void key_callback(GLFWwindow* window, int key, int, int action, int)
28 29
29Game::Game() : world_("res/maps.xml") 30Game::Game() : world_("res/maps.xml")
30{ 31{
32 systemManager_.emplaceSystem<PlayingSystem>(*this);
31 systemManager_.emplaceSystem<ControllingSystem>(*this); 33 systemManager_.emplaceSystem<ControllingSystem>(*this);
32 systemManager_.emplaceSystem<OrientingSystem>(*this); 34 systemManager_.emplaceSystem<OrientingSystem>(*this);
33 systemManager_.emplaceSystem<PonderingSystem>(*this); 35 systemManager_.emplaceSystem<PonderingSystem>(*this);
34 systemManager_.emplaceSystem<MappingSystem>(*this); 36 systemManager_.emplaceSystem<MappingSystem>(*this);
35 systemManager_.emplaceSystem<AnimatingSystem>(*this); 37 systemManager_.emplaceSystem<AnimatingSystem>(*this);
36 38
37 int player = entityManager_.emplaceEntity(); 39 systemManager_.getSystem<PlayingSystem>().initPlayer();
38
39 AnimationSet playerGraphics {"res/Starla.png", 10, 12, 6};
40 playerGraphics.emplaceAnimation("stillLeft", 3, 1, 1);
41 playerGraphics.emplaceAnimation("stillRight", 0, 1, 1);
42 playerGraphics.emplaceAnimation("walkingLeft", 4, 2, 10);
43 playerGraphics.emplaceAnimation("walkingRight", 1, 2, 10);
44
45 entityManager_.emplaceComponent<AnimatableComponent>(
46 player,
47 std::move(playerGraphics),
48 "stillLeft");
49
50 entityManager_.emplaceComponent<TransformableComponent>(
51 player,
52 203, 44, 10, 12);
53
54 systemManager_.getSystem<PonderingSystem>().initializeBody(
55 player,
56 PonderableComponent::Type::freefalling);
57
58 entityManager_.emplaceComponent<ControllableComponent>(player);
59 entityManager_.emplaceComponent<OrientableComponent>(player);
60
61 systemManager_.getSystem<MappingSystem>().loadMap(world_.getStartingMapId()); 40 systemManager_.getSystem<MappingSystem>().loadMap(world_.getStartingMapId());
62 41
63 glfwSwapInterval(1); 42 glfwSwapInterval(1);