aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax-001 <maxsmits21@kpnmail.nl>2024-12-21 11:52:48 +0100
committerMax-001 <maxsmits21@kpnmail.nl>2024-12-21 11:52:48 +0100
commite72dc913e7b35bcd2f6ba8107ea46e383afd25e1 (patch)
treeaf3a5303617e0b94e8163af0285b8834b2c6a860
parent799a376aeecd9bdc712e89324cbe9153206839c9 (diff)
Added more to Config.h
-rw-r--r--game/Config.h6
-rw-r--r--game/GameScene.cpp3
-rw-r--r--game/background/AquariumSubScene.cpp12
-rw-r--r--game/background/ForestSubScene.cpp8
-rw-r--r--game/background/HallwaySubScene.cpp12
-rw-r--r--game/background/StartSubScene.cpp4
6 files changed, 26 insertions, 19 deletions
diff --git a/game/Config.h b/game/Config.h
index 0d6f880..7c16b47 100644
--- a/game/Config.h
+++ b/game/Config.h
@@ -7,3 +7,9 @@ static constexpr int SORT_IN_LAY_PARTICLES_BACKGROUND = 6; // For all scenes
static constexpr int SORT_IN_LAY_OBSTACLES = 8; // Only for GameScene
static constexpr int SORT_IN_LAY_PLAYER = 10; // Only for GameScene
static constexpr int SORT_IN_LAY_PARTICLES_FOREGROUND = 15; // Only for GameScene
+
+static constexpr int GAME_HEIGHT = 800; // In game units
+
+static constexpr int VIEWPORT_X = 1100; // In game units
+// 'GAME_HEIGHT' (below) should be replaced by '500' when game development is finished
+static constexpr int VIEWPORT_Y = GAME_HEIGHT; // In game units
diff --git a/game/GameScene.cpp b/game/GameScene.cpp
index 9606244..db1a753 100644
--- a/game/GameScene.cpp
+++ b/game/GameScene.cpp
@@ -1,4 +1,5 @@
#include "GameScene.h"
+#include "Config.h"
#include "MoveCameraManualyScript.h"
#include "PlayerSubScene.h"
#include "StartGameScript.h"
@@ -29,7 +30,7 @@ void GameScene::load_scene() {
BackgroundSubScene background(*this);
GameObject camera = new_object("camera", "camera", vec2(650, 0));
- camera.add_component<Camera>(ivec2(990, 720), vec2(1100, 800),
+ camera.add_component<Camera>(ivec2(990, 720), vec2(VIEWPORT_X, VIEWPORT_Y),
Camera::Data{
.bg_color = Color::RED,
});
diff --git a/game/background/AquariumSubScene.cpp b/game/background/AquariumSubScene.cpp
index 9994a9e..579e633 100644
--- a/game/background/AquariumSubScene.cpp
+++ b/game/background/AquariumSubScene.cpp
@@ -21,7 +21,7 @@ float AquariumSubScene::create(Scene & scn, float begin_x) {
Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 0,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 600;
@@ -32,7 +32,7 @@ float AquariumSubScene::create(Scene & scn, float begin_x) {
Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 2,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 400;
@@ -45,7 +45,7 @@ float AquariumSubScene::create(Scene & scn, float begin_x) {
Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 3,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 400;
@@ -56,7 +56,7 @@ float AquariumSubScene::create(Scene & scn, float begin_x) {
Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 4,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 400;
@@ -69,7 +69,7 @@ float AquariumSubScene::create(Scene & scn, float begin_x) {
Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 5,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 600;
@@ -81,7 +81,7 @@ float AquariumSubScene::create(Scene & scn, float begin_x) {
Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 1,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 600;
diff --git a/game/background/ForestSubScene.cpp b/game/background/ForestSubScene.cpp
index f0848f2..7eac53a 100644
--- a/game/background/ForestSubScene.cpp
+++ b/game/background/ForestSubScene.cpp
@@ -26,7 +26,7 @@ float ForestSubScene::create(Scene & scn, float begin_x, std::string unique_bg_n
begin.add_component<Sprite>(begin_asset, Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 0,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 800;
@@ -38,7 +38,7 @@ float ForestSubScene::create(Scene & scn, float begin_x, std::string unique_bg_n
Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 2,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 800;
@@ -50,7 +50,7 @@ float ForestSubScene::create(Scene & scn, float begin_x, std::string unique_bg_n
Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 3,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 800;
@@ -61,7 +61,7 @@ float ForestSubScene::create(Scene & scn, float begin_x, std::string unique_bg_n
end.add_component<Sprite>(end_asset, Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 1,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 600;
diff --git a/game/background/HallwaySubScene.cpp b/game/background/HallwaySubScene.cpp
index b5e3635..2aa9bab 100644
--- a/game/background/HallwaySubScene.cpp
+++ b/game/background/HallwaySubScene.cpp
@@ -18,7 +18,7 @@ float HallwaySubScene::create(Scene & scn, float begin_x, unsigned int sector_nu
begin.add_component<Sprite>(begin_asset, Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 0,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 600;
@@ -32,7 +32,7 @@ float HallwaySubScene::create(Scene & scn, float begin_x, unsigned int sector_nu
Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 2,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 600;
@@ -42,7 +42,7 @@ float HallwaySubScene::create(Scene & scn, float begin_x, unsigned int sector_nu
Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 3,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 200;
@@ -52,7 +52,7 @@ float HallwaySubScene::create(Scene & scn, float begin_x, unsigned int sector_nu
Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 4,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 400;
@@ -64,7 +64,7 @@ float HallwaySubScene::create(Scene & scn, float begin_x, unsigned int sector_nu
Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 5,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 600;
@@ -73,7 +73,7 @@ float HallwaySubScene::create(Scene & scn, float begin_x, unsigned int sector_nu
end.add_component<Sprite>(end_asset, Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 1,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 600;
diff --git a/game/background/StartSubScene.cpp b/game/background/StartSubScene.cpp
index 547b00d..c769a5f 100644
--- a/game/background/StartSubScene.cpp
+++ b/game/background/StartSubScene.cpp
@@ -22,7 +22,7 @@ float StartSubScene::create(Scene & scn, float begin_x) {
begin.add_component<Sprite>(begin_asset, Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 0,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
GameObject hole = scn.new_object("start_hole", "background", vec2(begin_x - 250, 140));
Asset hole_asset{"asset/background/start/titleWallHole.png"};
@@ -44,7 +44,7 @@ float StartSubScene::create(Scene & scn, float begin_x) {
end.add_component<Sprite>(end_asset, Sprite::Data{
.sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 1,
- .size = vec2(0, 800),
+ .size = vec2(0, GAME_HEIGHT),
});
begin_x += 100;