aboutsummaryrefslogtreecommitdiff
path: root/src/example
diff options
context:
space:
mode:
authormax-001 <maxsmits21@kpnmail.nl>2024-12-17 10:14:08 +0100
committermax-001 <maxsmits21@kpnmail.nl>2024-12-17 10:14:08 +0100
commitdfa0ad1f97fb49d281fd2eb0bf640c41727cab56 (patch)
treeaee92e99deb905f327de17449ec8eb7410ab5fcc /src/example
parent19d70481301e89481da64bc9bc59e1b81697c9e3 (diff)
Added table
Diffstat (limited to 'src/example')
-rw-r--r--src/example/Start.cpp27
-rw-r--r--src/example/Start.h3
2 files changed, 30 insertions, 0 deletions
diff --git a/src/example/Start.cpp b/src/example/Start.cpp
index d1e1d07..9e194fe 100644
--- a/src/example/Start.cpp
+++ b/src/example/Start.cpp
@@ -1,4 +1,6 @@
#include "Start.h"
+#include "api/Asset.h"
+#include "types.h"
#include <crepe/api/Animator.h>
#include <crepe/api/GameObject.h>
@@ -18,6 +20,8 @@ float Start::create(Scene & scn, float begin_x) {
});
begin_x += 700;
+ this->add_table(begin, vec2(-125, 175));
+
GameObject end = scn.new_object("start_end", "background", vec2(begin_x, 0));
Asset end_asset{"asset/jetpack_joyride/background/start/titleFG_2_TVOS.png"};
end.add_component<Sprite>(end_asset, Sprite::Data{
@@ -54,3 +58,26 @@ void Start::add_lamp(GameObject & obj, vec2 offset, unsigned int fps) {
.looping = true,
});
}
+
+void Start::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,
+ .order_in_layer = 0,
+ .size = vec2(0, 100),
+ .position_offset = offset,
+ });
+ Asset gramophone_asset{"asset/jetpack_joyride/background/start/gramophone_TVOS.png"};
+ Sprite & gramophone_sprite = obj.add_component<Sprite>(
+ gramophone_asset, Sprite::Data{
+ .sorting_in_layer = 5,
+ .order_in_layer = 1,
+ .size = vec2(0, 100),
+ .position_offset = offset + vec2(0, -50),
+ });
+ obj.add_component<Animator>(gramophone_sprite, ivec2(64, 128), uvec2(2, 1),
+ Animator::Data{
+ .fps = 10,
+ .looping = true,
+ });
+}
diff --git a/src/example/Start.h b/src/example/Start.h
index 37d1141..94a34bb 100644
--- a/src/example/Start.h
+++ b/src/example/Start.h
@@ -13,4 +13,7 @@ public:
private:
void add_lamp(crepe::GameObject & obj, crepe::vec2 offset, unsigned int fps = 10);
+ void add_table(crepe::GameObject & obj, crepe::vec2 offset);
+ void add_light(crepe::GameObject & obj, crepe::vec2 offset);
+ void add_jetpack_stand(crepe::GameObject & obj, crepe::vec2 offset);
};