8#include "EngineContext.hpp"
9#include "graphical/renderWindow.hpp"
10#include "sceneManager/sceneConcept.hpp"
12#include "components/AABBCollider.hpp"
13#include "components/Controllable.hpp"
14#include "components/Transform.hpp"
15#include "components/Velocity.hpp"
17#include "systems/AnimationSystem.hpp"
18#include "systems/AnimatorSystem.hpp"
19#include "systems/RenderConcept.hpp"
21#include "sceneType.hpp"
23namespace rtype::client {
38 explicit GameScene(rtk::RenderWindow &window);
69 const std::string &bp) {
70 const float scaledWidth = 720.0f;
72 for (
int i = 0; i < 3; ++i) {
79 transform->position.x = i * scaledWidth;
82 _entities.push_back(bg);
93 _entities.push_back(gateEntity);
102 transform->position.x = startX;
103 transform->position.y = 0.0f;
107 _entities.push_back(ceilingEntity);
109 return startX + (192.0f * 2.0f);
118 _entities.push_back(rampEntity);
126 transform->position.x = startX;
127 transform->position.y = 0.0f;
131 _entities.push_back(ceilingEntity);
133 return startX + (192.0f * 2.0f);
143 _entities.push_back(reactorEntity);
151 transform->position.x = startX;
152 transform->position.y = 0.0f;
156 _entities.push_back(ceilingEntity);
158 return startX + (113.0f * 2.0f);
166 .get(highGroundEntity)
168 _entities.push_back(highGroundEntity);
176 transform->position.x = startX;
177 transform->position.y = 0.0f;
181 _entities.push_back(ceilingEntity);
183 return startX + (64.0f * 2.0f);
191 .get(lowGroundEntity)
193 _entities.push_back(lowGroundEntity);
201 transform->position.x = startX;
202 transform->position.y = 0.0f;
206 _entities.push_back(ceilingEntity);
208 return startX + (256.0f * 2.0f);
218 _entities.push_back(groundEntity);
226 transform->position.x = startX;
227 transform->position.y = 0.0f;
231 _entities.push_back(ceilingEntity);
233 return startX + (64.0f * 2.0f);
237 float currentX = 0.0f;
238 currentX = createMediumGround((context), currentX,
false);
239 currentX = createLowGround((context), currentX,
false);
240 currentX = createHighGround((context), currentX,
false);
241 currentX = createMediumGround((context), currentX,
false);
242 currentX = createLowGround((context), currentX,
false);
243 currentX = createHighGround((context), currentX,
false);
244 currentX = createHighGround((context), currentX,
false);
245 currentX = createMediumGround((context), currentX,
false);
246 currentX = createLowGround((context), currentX,
false);
247 currentX = createMediumGround((context), currentX,
false);
248 currentX = createReactor(context, currentX,
true);
249 currentX = createLowGround((context), currentX,
true);
250 currentX = createMediumGround((context), currentX,
true);
251 currentX = createHighGround((context), currentX,
true);
252 currentX = createLowGround((context), currentX,
true);
253 currentX = createRamp((context), currentX,
true);
254 currentX = createMediumGround((context), currentX,
true);
255 currentX = createMediumGround((context), currentX,
true);
256 currentX = createMediumGround((context), currentX,
true);
257 currentX = createHighGround((context), currentX,
true);
258 currentX = createGate((context), currentX,
true);
259 currentX = createLowGround((context), currentX,
true);
260 currentX = createMediumGround((context), currentX,
true);
261 currentX = createHighGround((context), currentX,
true);
271 rtk::RenderWindow &_window;
273 std::vector<std::size_t> _entities;
274 std::optional<std::size_t> _playerEntity;
276 std::vector<std::size_t> bullets;
278 std::uint32_t _textureId = 0;
279 std::uint32_t _backgroundTextureId = 0;
281 std::uint16_t _bulletPressedByTick = 0;
std::size_t createFromBlueprint(rtk::ecs::Registry ®, const std::string &blueprintName)
Spawns an entity from a loaded blueprint.
Definition factoryDataDriven.hpp:195
In game scene, which shows the scrolling starfield.
Definition gameScene.hpp:32
void onEnter(rtk::EngineContext &context)
Creates the two parallax starfield layers.
Definition gameScene.cpp:16
void onExit(rtk::EngineContext &context)
Destroys the entities created by the scene.
Definition gameScene.cpp:28
std::optional< SceneType > onUpdate(rtk::EngineContext &context, const rtk::InputState &inputState, float dt)
Does nothing, the game stays in this scene.
Definition gameScene.cpp:21
GameScene(rtk::RenderWindow &window)
Creates the scene.
Definition gameScene.cpp:14
static constexpr SceneType Type
Identifier of this scene.
Definition gameScene.hpp:42
SceneType
Identifiers of the client scenes.
Definition sceneType.hpp:12
Engine services handed to the game and its scenes.
Definition EngineContext.hpp:20
rtk::factory::EntityFactory _entityFactory
Blueprint based entity factory.
Definition EngineContext.hpp:25
ecs::Registry & registry
Entities and components.
Definition EngineContext.hpp:21
Everything the renderer needs to draw one sprite.
Definition RenderConcept.hpp:338
uint32_t flags
Bit 0 flips horizontally, bit 1 vertically.
Definition RenderConcept.hpp:350
float x
Horizontal component.
Definition vec2.hpp:13