diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-12 22:45:30 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-12-12 22:45:30 +0100 |
commit | 1d1c256eea43a3d0685919ed2997e10990ef639f (patch) | |
tree | 99f85ea9d8852ba3e33a05df699f028f29d3f9d1 /src/example/replay.cpp | |
parent | 23196be83778973d9688cc5d465e4e4a16476568 (diff) |
`make format`
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(""); |