aboutsummaryrefslogtreecommitdiff
path: root/src/example/Start.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/example/Start.cpp')
-rw-r--r--src/example/Start.cpp27
1 files changed, 27 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,
+ });
+}