diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-20 14:01:04 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-20 14:01:04 +0100 |
commit | d79148947bc43764b041687b7c6ad2d6c944f70b (patch) | |
tree | 0781e6960f040662d03788ea6e2d7dce2828a087 /src/example | |
parent | 4d1c6f1831e0a95029ff7af4cf8097e837dc2a5d (diff) | |
parent | f78e8011ee77ba5303a5e608cc81c3b303d35943 (diff) |
merge `master` into `loek/util`
Diffstat (limited to 'src/example')
-rw-r--r-- | src/example/rendering.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/example/rendering.cpp b/src/example/rendering.cpp index c813524..522ec0f 100644 --- a/src/example/rendering.cpp +++ b/src/example/rendering.cpp @@ -30,14 +30,27 @@ int main() { // Normal adding components { Color color(0, 0, 0, 0); - obj.add_component<Sprite>( - make_shared<Texture>("asset/texture/img.png"), color, FlipSettings{false, false}); - obj.add_component<Camera>(Color::get_red()); + Sprite & sprite + = obj.add_component<Sprite>(make_shared<Texture>("asset/texture/img.png"), + color, FlipSettings{false, false}); + sprite.sorting_in_layer = 2; + sprite.order_in_layer = 1; + obj.add_component<Camera>(Color::RED); } { Color color(0, 0, 0, 0); - obj1.add_component<Sprite>( - make_shared<Texture>("asset/texture/second.png"), color, FlipSettings{true, true}); + Sprite & sprite = obj1.add_component<Sprite>( + make_shared<Texture>("asset/texture/img.png"), color, FlipSettings{true, true}); + sprite.sorting_in_layer = 2; + sprite.order_in_layer = 2; + } + + { + Color color(0, 0, 0, 0); + Sprite & sprite = obj2.add_component<Sprite>( + make_shared<Texture>("asset/texture/img.png"), color, FlipSettings{true, true}); + sprite.sorting_in_layer = 1; + sprite.order_in_layer = 2; } /* @@ -48,8 +61,12 @@ int main() { } */ + sys.update(); + /* + auto start = std::chrono::steady_clock::now(); while (std::chrono::steady_clock::now() - start < std::chrono::seconds(5)) { sys.update(); } + */ } |