aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/example/AquariumSubScene.cpp (renamed from src/example/Aquarium.cpp)6
-rw-r--r--src/example/AquariumSubScene.h (renamed from src/example/Aquarium.h)2
-rw-r--r--src/example/Background.h10
-rw-r--r--src/example/BackgroundSubScene.cpp (renamed from src/example/Background.cpp)20
-rw-r--r--src/example/BackgroundSubScene.h10
-rw-r--r--src/example/CMakeLists.txt24
-rw-r--r--src/example/ForestSubScene.cpp (renamed from src/example/Forest.cpp)6
-rw-r--r--src/example/ForestSubScene.h (renamed from src/example/Forest.h)2
-rw-r--r--src/example/GameScene.cpp10
-rw-r--r--src/example/HallwaySubScene.cpp (renamed from src/example/Hallway.cpp)12
-rw-r--r--src/example/HallwaySubScene.h (renamed from src/example/Hallway.h)2
-rw-r--r--src/example/Player.h10
-rw-r--r--src/example/PlayerSubScene.cpp (renamed from src/example/Player.cpp)4
-rw-r--r--src/example/PlayerSubScene.h10
-rw-r--r--src/example/StartSubScene.cpp (renamed from src/example/Start.cpp)22
-rw-r--r--src/example/StartSubScene.h (renamed from src/example/Start.h)2
16 files changed, 75 insertions, 77 deletions
diff --git a/src/example/Aquarium.cpp b/src/example/AquariumSubScene.cpp
index df44483..4f13acf 100644
--- a/src/example/Aquarium.cpp
+++ b/src/example/AquariumSubScene.cpp
@@ -1,4 +1,4 @@
-#include "Aquarium.h"
+#include "AquariumSubScene.h"
#include <crepe/api/Animator.h>
#include <crepe/api/GameObject.h>
@@ -9,7 +9,7 @@
using namespace crepe;
using namespace std;
-float Aquarium::create(Scene & scn, float begin_x) {
+float AquariumSubScene::create(Scene & scn, float begin_x) {
this->add_background(scn, begin_x);
GameObject aquarium_begin
@@ -86,7 +86,7 @@ float Aquarium::create(Scene & scn, float begin_x) {
return begin_x;
}
-void Aquarium::add_background(Scene & scn, float begin_x) {
+void AquariumSubScene::add_background(Scene & scn, float begin_x) {
GameObject bg_1 = scn.new_object("aquarium_bg_1", "aquarium_background", vec2(begin_x, 0));
Asset bg_1_1_asset{"asset/jetpack_joyride/background/aquarium/AquariumBG1_1_TVOS.png"};
bg_1.add_component<Sprite>(bg_1_1_asset, Sprite::Data{
diff --git a/src/example/Aquarium.h b/src/example/AquariumSubScene.h
index 8815e9c..2a188bc 100644
--- a/src/example/Aquarium.h
+++ b/src/example/AquariumSubScene.h
@@ -4,7 +4,7 @@ namespace crepe {
class Scene;
}
-class Aquarium {
+class AquariumSubScene {
public:
float create(crepe::Scene & scn, float begin_x);
diff --git a/src/example/Background.h b/src/example/Background.h
deleted file mode 100644
index 7c5a2bb..0000000
--- a/src/example/Background.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#pragma once
-
-namespace crepe {
-class Scene;
-}
-
-class Background {
-public:
- Background(crepe::Scene & scn);
-};
diff --git a/src/example/Background.cpp b/src/example/BackgroundSubScene.cpp
index 0ad2c0c..6fdc598 100644
--- a/src/example/Background.cpp
+++ b/src/example/BackgroundSubScene.cpp
@@ -1,19 +1,19 @@
-#include "Background.h"
-#include "Aquarium.h"
-#include "Forest.h"
-#include "Hallway.h"
-#include "Start.h"
+#include "BackgroundSubScene.h"
+#include "AquariumSubScene.h"
+#include "ForestSubScene.h"
+#include "HallwaySubScene.h"
+#include "StartSubScene.h"
#include <crepe/api/Color.h>
using namespace crepe;
using namespace std;
-Background::Background(Scene & scn) {
- Start start;
- Hallway hallway;
- Forest forest;
- Aquarium aquarium;
+BackgroundSubScene::BackgroundSubScene(Scene & scn) {
+ StartSubScene start;
+ HallwaySubScene hallway;
+ ForestSubScene forest;
+ AquariumSubScene aquarium;
float begin_x = 400;
diff --git a/src/example/BackgroundSubScene.h b/src/example/BackgroundSubScene.h
new file mode 100644
index 0000000..06bdac4
--- /dev/null
+++ b/src/example/BackgroundSubScene.h
@@ -0,0 +1,10 @@
+#pragma once
+
+namespace crepe {
+class Scene;
+}
+
+class BackgroundSubScene {
+public:
+ BackgroundSubScene(crepe::Scene & scn);
+};
diff --git a/src/example/CMakeLists.txt b/src/example/CMakeLists.txt
index ef2595f..c1ccdec 100644
--- a/src/example/CMakeLists.txt
+++ b/src/example/CMakeLists.txt
@@ -1,22 +1,22 @@
set(GAME_HEADERS
- Aquarium.h
- Background.h
- Forest.h
- Hallway.h
- Start.h
+ AquariumSubScene.h
+ BackgroundSubScene.h
+ ForestSubScene.h
+ HallwaySubScene.h
+ StartSubScene.h
GameScene.h
- Player.h
+ PlayerSubScene.h
)
set(GAME_SOURCES
game.cpp
- Aquarium.cpp
- Background.cpp
- Forest.cpp
- Hallway.cpp
- Start.cpp
+ AquariumSubScene.cpp
+ BackgroundSubScene.cpp
+ ForestSubScene.cpp
+ HallwaySubScene.cpp
+ StartSubScene.cpp
GameScene.cpp
- Player.cpp
+ PlayerSubScene.cpp
)
add_executable(game ${GAME_SOURCES} ${GAME_HEADERS})
diff --git a/src/example/Forest.cpp b/src/example/ForestSubScene.cpp
index 3c45e09..d472ab4 100644
--- a/src/example/Forest.cpp
+++ b/src/example/ForestSubScene.cpp
@@ -1,4 +1,4 @@
-#include "Forest.h"
+#include "ForestSubScene.h"
#include <crepe/api/Animator.h>
#include <crepe/api/BehaviorScript.h>
@@ -42,7 +42,7 @@ private:
const std::string name;
};
-float Forest::create(Scene & scn, float begin_x, std::string unique_bg_name) {
+float ForestSubScene::create(Scene & scn, float begin_x, std::string unique_bg_name) {
GameObject script = scn.new_object("forest_script", "background");
script.add_component<BehaviorScript>().set_script<ParallaxScript>(
begin_x - 400, begin_x + 3000 + 400, unique_bg_name);
@@ -96,7 +96,7 @@ float Forest::create(Scene & scn, float begin_x, std::string unique_bg_name) {
return begin_x;
}
-void Forest::add_background(Scene & scn, float begin_x, std::string name) {
+void ForestSubScene::add_background(Scene & scn, float begin_x, std::string name) {
GameObject bg_1
= scn.new_object("forest_bg_1_" + name, "forest_background", vec2(begin_x, 0));
Asset bg_1_asset{"asset/jetpack_joyride/background/forest/forestBG1_1_TVOS.png"};
diff --git a/src/example/Forest.h b/src/example/ForestSubScene.h
index f612c91..0a04001 100644
--- a/src/example/Forest.h
+++ b/src/example/ForestSubScene.h
@@ -6,7 +6,7 @@ namespace crepe {
class Scene;
}
-class Forest {
+class ForestSubScene {
public:
float create(crepe::Scene & scn, float begin_x, std::string unique_bg_name);
diff --git a/src/example/GameScene.cpp b/src/example/GameScene.cpp
index 5f252e6..faa08fe 100644
--- a/src/example/GameScene.cpp
+++ b/src/example/GameScene.cpp
@@ -1,7 +1,6 @@
#include "GameScene.h"
-#include "Background.h"
-#include "Player.h"
-#include "api/ParticleEmitter.h"
+#include "BackgroundSubScene.h"
+#include "PlayerSubScene.h"
#include <cmath>
#include <crepe/api/Animator.h>
@@ -12,6 +11,7 @@
#include <crepe/api/Color.h>
#include <crepe/api/Event.h>
#include <crepe/api/GameObject.h>
+#include <crepe/api/ParticleEmitter.h>
#include <crepe/api/Rigidbody.h>
#include <crepe/api/Script.h>
#include <crepe/api/Sprite.h>
@@ -107,7 +107,7 @@ private:
};
void GameScene::load_scene() {
- Background background(*this);
+ BackgroundSubScene background(*this);
GameObject camera = new_object("camera", "camera", vec2(650, 0));
camera.add_component<Camera>(ivec2(990, 720), vec2(1100, 800),
@@ -117,7 +117,7 @@ void GameScene::load_scene() {
camera.add_component<BehaviorScript>().set_script<MoveCameraScript>();
camera.add_component<Rigidbody>(Rigidbody::Data{});
- Player player(*this);
+ PlayerSubScene player(*this);
GameObject floor = new_object("floor", "game_world", vec2(0, 325));
floor.add_component<Rigidbody>(Rigidbody::Data{
diff --git a/src/example/Hallway.cpp b/src/example/HallwaySubScene.cpp
index 59d200f..4fe2267 100644
--- a/src/example/Hallway.cpp
+++ b/src/example/HallwaySubScene.cpp
@@ -1,4 +1,4 @@
-#include "Hallway.h"
+#include "HallwaySubScene.h"
#include <crepe/api/Animator.h>
#include <crepe/api/Color.h>
@@ -9,8 +9,8 @@
using namespace crepe;
using namespace std;
-float Hallway::create(Scene & scn, float begin_x, unsigned int sector_num,
- Color sector_color) {
+float HallwaySubScene::create(Scene & scn, float begin_x, unsigned int sector_num,
+ Color sector_color) {
GameObject begin = scn.new_object("hallway_begin", "background", vec2(begin_x, 0));
Asset begin_asset{"asset/jetpack_joyride/background/hallway/hallway1FG_1_TVOS.png"};
begin.add_component<Sprite>(begin_asset, Sprite::Data{
@@ -74,7 +74,7 @@ float Hallway::create(Scene & scn, float begin_x, unsigned int sector_num,
return begin_x;
}
-void Hallway::add_lamp(GameObject & obj, vec2 offset, unsigned int fps) {
+void HallwaySubScene::add_lamp(GameObject & obj, vec2 offset, unsigned int fps) {
Asset lamp_asset{"asset/jetpack_joyride/background/hallway/alarmLight_TVOS.png"};
obj.add_component<Sprite>(lamp_asset, Sprite::Data{
.sorting_in_layer = 5,
@@ -97,8 +97,8 @@ void Hallway::add_lamp(GameObject & obj, vec2 offset, unsigned int fps) {
});
}
-void Hallway::add_sector_number(GameObject & obj, vec2 offset, unsigned int sector_num,
- Color sector_color) {
+void HallwaySubScene::add_sector_number(GameObject & obj, vec2 offset, unsigned int sector_num,
+ Color sector_color) {
Asset sector_text_asset{"asset/jetpack_joyride/background/hallway/sectorText_TVOS.png"};
obj.add_component<Sprite>(sector_text_asset, Sprite::Data{
.color = sector_color,
diff --git a/src/example/Hallway.h b/src/example/HallwaySubScene.h
index f173313..acc9329 100644
--- a/src/example/Hallway.h
+++ b/src/example/HallwaySubScene.h
@@ -8,7 +8,7 @@ class GameObject;
class Color;
} // namespace crepe
-class Hallway {
+class HallwaySubScene {
public:
float create(crepe::Scene & scn, float begin_x, unsigned int sector_num,
crepe::Color sector_color);
diff --git a/src/example/Player.h b/src/example/Player.h
deleted file mode 100644
index 139f6e4..0000000
--- a/src/example/Player.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#pragma once
-
-namespace crepe {
-class Scene;
-}
-
-class Player {
-public:
- Player(crepe::Scene & scn);
-};
diff --git a/src/example/Player.cpp b/src/example/PlayerSubScene.cpp
index 49dfa2d..180ca17 100644
--- a/src/example/Player.cpp
+++ b/src/example/PlayerSubScene.cpp
@@ -1,4 +1,4 @@
-#include "Player.h"
+#include "PlayerSubScene.h"
#include <crepe/api/Animator.h>
#include <crepe/api/GameObject.h>
@@ -17,7 +17,7 @@ public:
}
};
-Player::Player(Scene & scn) {
+PlayerSubScene::PlayerSubScene(Scene & scn) {
GameObject player = scn.new_object("player", "player", vec2(-100, 200));
Asset player_body_asset{"asset/jetpack_joyride/barry/defaultBody.png"};
Sprite & player_body_sprite
diff --git a/src/example/PlayerSubScene.h b/src/example/PlayerSubScene.h
new file mode 100644
index 0000000..bf94c32
--- /dev/null
+++ b/src/example/PlayerSubScene.h
@@ -0,0 +1,10 @@
+#pragma once
+
+namespace crepe {
+class Scene;
+}
+
+class PlayerSubScene {
+public:
+ PlayerSubScene(crepe::Scene & scn);
+};
diff --git a/src/example/Start.cpp b/src/example/StartSubScene.cpp
index 356adf1..9006dc7 100644
--- a/src/example/Start.cpp
+++ b/src/example/StartSubScene.cpp
@@ -1,20 +1,18 @@
-#include "Start.h"
-#include "api/Asset.h"
-#include "api/CircleCollider.h"
-#include "api/Color.h"
-#include "api/Rigidbody.h"
-#include "types.h"
+#include "StartSubScene.h"
#include <crepe/api/Animator.h>
+#include <crepe/api/CircleCollider.h>
+#include <crepe/api/Color.h>
#include <crepe/api/GameObject.h>
#include <crepe/api/ParticleEmitter.h>
+#include <crepe/api/Rigidbody.h>
#include <crepe/api/Scene.h>
#include <crepe/api/Sprite.h>
using namespace crepe;
using namespace std;
-float Start::create(Scene & scn, float begin_x) {
+float StartSubScene::create(Scene & scn, float begin_x) {
this->create_wall_fragments(scn, begin_x - 300);
GameObject begin = scn.new_object("start_begin", "background", vec2(begin_x, 0));
@@ -52,7 +50,7 @@ float Start::create(Scene & scn, float begin_x) {
return begin_x;
}
-void Start::add_lamp(GameObject & obj, vec2 offset, unsigned int fps) {
+void StartSubScene::add_lamp(GameObject & obj, vec2 offset, unsigned int fps) {
Asset lamp_asset{"asset/jetpack_joyride/background/start/alarmLight_TVOS.png"};
obj.add_component<Sprite>(lamp_asset, Sprite::Data{
.sorting_in_layer = 5,
@@ -76,7 +74,7 @@ void Start::add_lamp(GameObject & obj, vec2 offset, unsigned int fps) {
});
}
-void Start::add_table(GameObject & obj, vec2 offset) {
+void StartSubScene::add_table(GameObject & obj, vec2 offset) {
Asset table_asset{"asset/jetpack_joyride/background/start/table.png"};
obj.add_component<Sprite>(table_asset, Sprite::Data{
.sorting_in_layer = 5,
@@ -99,7 +97,7 @@ void Start::add_table(GameObject & obj, vec2 offset) {
});
}
-void Start::add_light(crepe::GameObject & obj, crepe::vec2 offset) {
+void StartSubScene::add_light(crepe::GameObject & obj, crepe::vec2 offset) {
Asset light_asset{"asset/jetpack_joyride/background/start/title_light_TVOS.png"};
obj.add_component<Sprite>(light_asset, Sprite::Data{
.sorting_in_layer = 5,
@@ -123,7 +121,7 @@ void Start::add_light(crepe::GameObject & obj, crepe::vec2 offset) {
});
}
-void Start::add_jetpack_stand(crepe::GameObject & obj, crepe::vec2 offset) {
+void StartSubScene::add_jetpack_stand(crepe::GameObject & obj, crepe::vec2 offset) {
Asset jetpack_stand_asset{"asset/jetpack_joyride/background/start/JetpackStand.png"};
Sprite & jetpeck_stand_sprite
= obj.add_component<Sprite>(jetpack_stand_asset, Sprite::Data{
@@ -147,7 +145,7 @@ void Start::add_jetpack_stand(crepe::GameObject & obj, crepe::vec2 offset) {
});
}
-void Start::create_wall_fragments(crepe::Scene & scn, float begin_x) {
+void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
GameObject frag_1 = scn.new_object("frag_1", "wall_fragment", vec2(begin_x, 200));
Asset frag_1_asset{"asset/jetpack_joyride/background/start/StartWall_frag1.png"};
Sprite & frag_1_sprite
diff --git a/src/example/Start.h b/src/example/StartSubScene.h
index 24e0dbf..c83e3d5 100644
--- a/src/example/Start.h
+++ b/src/example/StartSubScene.h
@@ -7,7 +7,7 @@ class Scene;
class GameObject;
} // namespace crepe
-class Start {
+class StartSubScene {
public:
float create(crepe::Scene & scn, float begin_x);