diff options
Diffstat (limited to 'src/example/replay.cpp')
-rw-r--r-- | src/example/replay.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/example/replay.cpp b/src/example/replay.cpp index 130c0d3..82fd478 100644 --- a/src/example/replay.cpp +++ b/src/example/replay.cpp @@ -1,6 +1,6 @@ +#include <crepe/api/Config.h> #include <crepe/api/Engine.h> #include <crepe/api/Script.h> -#include <crepe/api/Config.h> using namespace crepe; using namespace std; @@ -9,13 +9,11 @@ class AnimationScript : public Script { Transform * transform; float t = 0; - void init() { - transform = &get_component<Transform>(); - } + void init() { transform = &get_component<Transform>(); } void update() { t += 0.05; - transform->position = { sin(t), cos(t) }; + transform->position = {sin(t), cos(t)}; } }; @@ -25,7 +23,8 @@ class Timeline : public Script { void update() { switch (i++) { - default: break; + default: + break; case 10: logf("record start"); replay.record_start(); @@ -56,17 +55,15 @@ public: ComponentManager & mgr = mediator.component_manager; GameObject cam = mgr.new_object("cam"); - cam.add_component<Camera>(ivec2{640,480},vec2{3,3}, Camera::Data{ - .bg_color = Color::WHITE, - }); + cam.add_component<Camera>(ivec2{640, 480}, vec2{3, 3}, + Camera::Data{ + .bg_color = Color::WHITE, + }); GameObject square = mgr.new_object("square"); - square.add_component<Sprite>( - Asset{"asset/texture/square.png"}, - Sprite::Data{ - .size = { 0.5, 0.5 }, - } - ); + square.add_component<Sprite>(Asset{"asset/texture/square.png"}, Sprite::Data{ + .size = {0.5, 0.5}, + }); square.add_component<BehaviorScript>().set_script<AnimationScript>(); GameObject scapegoat = mgr.new_object(""); |