From dfa0ad1f97fb49d281fd2eb0bf640c41727cab56 Mon Sep 17 00:00:00 2001 From: max-001 Date: Tue, 17 Dec 2024 10:14:08 +0100 Subject: Added table --- src/example/Start.cpp | 27 +++++++++++++++++++++++++++ src/example/Start.h | 3 +++ 2 files changed, 30 insertions(+) (limited to 'src/example') 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 #include @@ -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(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(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( + 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(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); }; -- cgit v1.2.3