diff options
-rw-r--r-- | src/example/Start.cpp | 27 | ||||
-rw-r--r-- | src/example/Start.h | 3 |
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); }; |