aboutsummaryrefslogtreecommitdiff
path: root/src/example/rendering.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-18 15:03:39 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-11-18 15:03:39 +0100
commitc9aac3ea385213b7b9a9a4e7e48e45e6a1268902 (patch)
treef7520e7684ae2cca9cdc4a863f72f5808145cac1 /src/example/rendering.cpp
parent03e493012edc106b00bc5676c1830ce2085a7ff9 (diff)
working sorting
Diffstat (limited to 'src/example/rendering.cpp')
-rw-r--r--src/example/rendering.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/example/rendering.cpp b/src/example/rendering.cpp
index c9e62f1..ecd3f6a 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});
+ 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::get_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();
}
+ */
}