diff --git a/headers/enduro2d/high/components/layout.hpp b/headers/enduro2d/high/components/layout.hpp index acbdcf6e..c283f414 100644 --- a/headers/enduro2d/high/components/layout.hpp +++ b/headers/enduro2d/high/components/layout.hpp @@ -24,6 +24,7 @@ namespace e2d (center) (right) (space_around) + (space_evenly) (space_between)) ENUM_HPP_CLASS_DECL(valigns, u8, @@ -31,6 +32,7 @@ namespace e2d (center) (bottom) (space_around) + (space_evenly) (space_between)) public: layout() = default; diff --git a/samples/bin/library/scripts/emmy/components/layout.lua b/samples/bin/library/scripts/emmy/components/layout.lua index 6a8a61f6..d489f076 100644 --- a/samples/bin/library/scripts/emmy/components/layout.lua +++ b/samples/bin/library/scripts/emmy/components/layout.lua @@ -43,6 +43,7 @@ layout.haligns = { center = "center", right = "right", space_around = "space_around", + space_evenly = "space_evenly", space_between = "space_between" } @@ -52,6 +53,7 @@ layout.valigns = { center = "center", bottom = "bottom", space_around = "space_around", + space_evenly = "space_evenly", space_between = "space_between" } diff --git a/sources/enduro2d/high/bindings/high_binds/components/layout_binds.cpp b/sources/enduro2d/high/bindings/high_binds/components/layout_binds.cpp index 80da8010..b780cc68 100644 --- a/sources/enduro2d/high/bindings/high_binds/components/layout_binds.cpp +++ b/sources/enduro2d/high/bindings/high_binds/components/layout_binds.cpp @@ -144,6 +144,7 @@ namespace e2d::bindings::high LAYOUT_HALIGN_PAIR(center) LAYOUT_HALIGN_PAIR(right) LAYOUT_HALIGN_PAIR(space_around) + LAYOUT_HALIGN_PAIR(space_evenly) LAYOUT_HALIGN_PAIR(space_between) }); #undef LAYOUT_HALIGN_PAIR @@ -155,6 +156,7 @@ namespace e2d::bindings::high LAYOUT_VALIGN_PAIR(center) LAYOUT_VALIGN_PAIR(bottom) LAYOUT_VALIGN_PAIR(space_around) + LAYOUT_VALIGN_PAIR(space_evenly) LAYOUT_VALIGN_PAIR(space_between) }); #undef LAYOUT_VALIGN_PAIR diff --git a/sources/enduro2d/high/components/layout.cpp b/sources/enduro2d/high/components/layout.cpp index 002c129b..3de05e66 100644 --- a/sources/enduro2d/high/components/layout.cpp +++ b/sources/enduro2d/high/components/layout.cpp @@ -37,6 +37,7 @@ namespace e2d "center", "right", "space_around", + "space_evenly", "space_between" ] }, @@ -47,6 +48,7 @@ namespace e2d "center", "bottom", "space_around", + "space_evenly", "space_between" ] } diff --git a/sources/enduro2d/high/systems/layout_system.cpp b/sources/enduro2d/high/systems/layout_system.cpp index 5122991d..0b4f7bdb 100644 --- a/sources/enduro2d/high/systems/layout_system.cpp +++ b/sources/enduro2d/high/systems/layout_system.cpp @@ -45,6 +45,9 @@ namespace case layout::haligns::space_around: YGNodeStyleSetJustifyContent(yn.as_root.get(), YGJustifySpaceAround); break; + case layout::haligns::space_evenly: + YGNodeStyleSetJustifyContent(yn.as_root.get(), YGJustifySpaceEvenly); + break; case layout::haligns::space_between: YGNodeStyleSetJustifyContent(yn.as_root.get(), YGJustifySpaceBetween); break; @@ -60,6 +63,7 @@ namespace break; case layout::valigns::center: case layout::valigns::space_around: + case layout::valigns::space_evenly: YGNodeStyleSetAlignItems(yn.as_root.get(), YGAlignCenter); break; case layout::valigns::bottom: @@ -87,6 +91,9 @@ namespace case layout::valigns::space_around: YGNodeStyleSetJustifyContent(yn.as_root.get(), YGJustifySpaceAround); break; + case layout::valigns::space_evenly: + YGNodeStyleSetJustifyContent(yn.as_root.get(), YGJustifySpaceEvenly); + break; case layout::valigns::space_between: YGNodeStyleSetJustifyContent(yn.as_root.get(), YGJustifySpaceBetween); break; @@ -102,6 +109,7 @@ namespace break; case layout::haligns::center: case layout::haligns::space_around: + case layout::haligns::space_evenly: YGNodeStyleSetAlignItems(yn.as_root.get(), YGAlignCenter); break; case layout::haligns::right: @@ -164,7 +172,7 @@ namespace owner.for_joined_components([]( ecs::entity e, - const layout& l, + const layout&, const actor& a) { e.ensure_component(); @@ -226,8 +234,8 @@ namespace YGDirectionLTR); for ( const auto& item : items ) { - auto& item_a = item.owner().component(); - const auto& item_yn = item.owner().component(); + gcomponent item_a = item.owner().component(); + const_gcomponent item_yn = item.owner().component(); if ( item_a && item_a->node() && item_yn && item_yn->as_item ) { item_a->node()->translation(v2f( YGNodeLayoutGetLeft(item_yn->as_item.get()),