From 88f613cbb2e4aaf3ed55ac0c6490706dd6f6f19d Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Mon, 18 Nov 2024 20:12:31 +0100 Subject: rendering based on world unites instead of pixels --- src/example/rendering.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/example/rendering.cpp') diff --git a/src/example/rendering.cpp b/src/example/rendering.cpp index 3631c76..1db57e5 100644 --- a/src/example/rendering.cpp +++ b/src/example/rendering.cpp @@ -1,4 +1,6 @@ +#include "api/Animator.h" #include "api/Camera.h" +#include "system/AnimatorSystem.h" #include #include #include @@ -22,6 +24,7 @@ int main() { ComponentManager mgr{}; RenderSystem sys{mgr}; + AnimatorSystem anim_sys {mgr}; GameObject obj = mgr.new_object("name", "tag", Vector2{250, 0}, 0, 1); GameObject obj1 = mgr.new_object("name", "tag", Vector2{500, 0}, 1, 0.1); @@ -30,10 +33,10 @@ int main() { // Normal adding components { Color color(0, 0, 0, 0); - obj.add_component(make_shared("../asset/texture/img.png"), color, + Sprite & sprite = obj.add_component(make_shared("../asset/spritesheet/spritesheet_test.png"), color, FlipSettings{false, false}); Camera & cam = obj.add_component(Color::get_red()); - + obj.add_component(sprite, 4,1,1).active = true; } /* { @@ -51,8 +54,10 @@ int main() { } */ + auto start = std::chrono::steady_clock::now(); while (std::chrono::steady_clock::now() - start < std::chrono::seconds(5)) { + anim_sys.update(); sys.update(); } } -- cgit v1.2.3