diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-11-13 19:05:25 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-11-13 19:05:25 +0100 |
commit | 0b2ca3c323c7f73d031e7014ba0a17dcf0b59751 (patch) | |
tree | 8a3ebeee7e2aab9ba064c62fce0cd33def6f2d18 /src/example | |
parent | 1d4b3a44c9ce1e69f4f0e3909998225f8af3fea2 (diff) | |
parent | f2509e89c02894ebd3ad992324eb300103621d26 (diff) |
merge with master
Diffstat (limited to 'src/example')
-rw-r--r-- | src/example/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/example/gameloop.cpp | 7 | ||||
-rw-r--r-- | src/example/rendering.cpp | 11 |
3 files changed, 14 insertions, 5 deletions
diff --git a/src/example/CMakeLists.txt b/src/example/CMakeLists.txt index 722ffea..3a5b543 100644 --- a/src/example/CMakeLists.txt +++ b/src/example/CMakeLists.txt @@ -29,4 +29,5 @@ add_example(db) add_example(ecs) add_example(scene_manager) add_example(particles) +add_example(gameloop) diff --git a/src/example/gameloop.cpp b/src/example/gameloop.cpp new file mode 100644 index 0000000..a676f20 --- /dev/null +++ b/src/example/gameloop.cpp @@ -0,0 +1,7 @@ +#include "crepe/api/LoopManager.h" +using namespace crepe; +int main() { + LoopManager gameloop; + gameloop.start(); + return 1; +} diff --git a/src/example/rendering.cpp b/src/example/rendering.cpp index d554a8a..e02f6a3 100644 --- a/src/example/rendering.cpp +++ b/src/example/rendering.cpp @@ -1,3 +1,4 @@ +#include "api/Camera.h" #include <crepe/ComponentManager.h> #include <crepe/api/GameObject.h> #include <crepe/system/RenderSystem.h> @@ -23,26 +24,26 @@ int main() { auto obj1 = GameObject(1, "name", "tag", Vector2{500, 0}, 1, 0.1); auto obj2 = GameObject(2, "name", "tag", Vector2{800, 0}, 1, 0.1); - auto & mgr = AssetManager::get_instance(); // Normal adding components { Color color(0, 0, 0, 0); obj.add_component<Sprite>( make_shared<Texture>("../asset/texture/img.png"), color, - FlipSettings{true, true}); + FlipSettings{false, false}); + obj.add_component<Camera>(Color::get_red()); } - { Color color(0, 0, 0, 0); - auto img = mgr.cache<Texture>("../asset/texture/second.png"); - obj1.add_component<Sprite>(img, color, FlipSettings{true, true}); + obj1.add_component<Sprite>(make_shared<Texture>("../asset/texture/second.png"), color, FlipSettings{true, true}); } + /* { Color color(0, 0, 0, 0); auto img = mgr.cache<Texture>("../asset/texture/second.png"); obj2.add_component<Sprite>(img, color, FlipSettings{true, true}); } + */ auto & sys = crepe::RenderSystem::get_instance(); auto start = std::chrono::steady_clock::now(); |