mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-14 16:09:06 +07:00
was_moved flag is removed because it's not used
This commit is contained in:
@@ -13,7 +13,6 @@ namespace e2d
|
|||||||
class layout final {
|
class layout final {
|
||||||
public:
|
public:
|
||||||
class dirty final {};
|
class dirty final {};
|
||||||
class was_moved final {};
|
|
||||||
public:
|
public:
|
||||||
ENUM_HPP_CLASS_DECL(modes, u8,
|
ENUM_HPP_CLASS_DECL(modes, u8,
|
||||||
(horizontal)
|
(horizontal)
|
||||||
@@ -98,20 +97,6 @@ namespace e2d
|
|||||||
asset_dependencies& dependencies,
|
asset_dependencies& dependencies,
|
||||||
const collect_context& ctx) const;
|
const collect_context& ctx) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
|
||||||
class factory_loader<layout::was_moved> final : factory_loader<> {
|
|
||||||
public:
|
|
||||||
static const char* schema_source;
|
|
||||||
|
|
||||||
bool operator()(
|
|
||||||
layout::was_moved& component,
|
|
||||||
const fill_context& ctx) const;
|
|
||||||
|
|
||||||
bool operator()(
|
|
||||||
asset_dependencies& dependencies,
|
|
||||||
const collect_context& ctx) const;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace e2d
|
namespace e2d
|
||||||
@@ -189,10 +174,6 @@ namespace e2d::layouts
|
|||||||
gcomponent<layout> unmark_dirty(gcomponent<layout> self);
|
gcomponent<layout> unmark_dirty(gcomponent<layout> self);
|
||||||
bool is_dirty(const const_gcomponent<layout>& self) noexcept;
|
bool is_dirty(const const_gcomponent<layout>& self) noexcept;
|
||||||
|
|
||||||
gcomponent<layout> mark_was_moved(gcomponent<layout> self);
|
|
||||||
gcomponent<layout> unmark_was_moved(gcomponent<layout> self);
|
|
||||||
bool is_was_moved(const const_gcomponent<layout>& self) noexcept;
|
|
||||||
|
|
||||||
gcomponent<layout> change_mode(gcomponent<layout> self, layout::modes value);
|
gcomponent<layout> change_mode(gcomponent<layout> self, layout::modes value);
|
||||||
gcomponent<layout> change_halign(gcomponent<layout> self, layout::haligns value);
|
gcomponent<layout> change_halign(gcomponent<layout> self, layout::haligns value);
|
||||||
gcomponent<layout> change_valign(gcomponent<layout> self, layout::valigns value);
|
gcomponent<layout> change_valign(gcomponent<layout> self, layout::valigns value);
|
||||||
|
|||||||
@@ -6,6 +6,15 @@
|
|||||||
"prototype" : "../prefabs/camera_prefab.json"
|
"prototype" : "../prefabs/camera_prefab.json"
|
||||||
},{
|
},{
|
||||||
"prototype" : "../prefabs/layout_prefab.json",
|
"prototype" : "../prefabs/layout_prefab.json",
|
||||||
|
"components" : {
|
||||||
|
"actor" : {
|
||||||
|
"translation" : [-250,0]
|
||||||
|
},
|
||||||
|
"layout" : {
|
||||||
|
"size" : [500,200],
|
||||||
|
"halign" : "space_evenly"
|
||||||
|
}
|
||||||
|
},
|
||||||
"children" : [{
|
"children" : [{
|
||||||
"prototype" : "../prefabs/layout_prefab.json",
|
"prototype" : "../prefabs/layout_prefab.json",
|
||||||
"components" : {
|
"components" : {
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ local layout = {
|
|||||||
---@type boolean
|
---@type boolean
|
||||||
dirty = false,
|
dirty = false,
|
||||||
|
|
||||||
---@type boolean
|
|
||||||
was_moved = false,
|
|
||||||
|
|
||||||
---@type layout_modes
|
---@type layout_modes
|
||||||
mode = layout.modes.horizontal,
|
mode = layout.modes.horizontal,
|
||||||
|
|
||||||
|
|||||||
@@ -67,19 +67,6 @@ namespace e2d::bindings::high
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
||||||
"was_moved", sol::property(
|
|
||||||
[](const gcomponent<layout>& c) -> bool {
|
|
||||||
return layouts::is_was_moved(c);
|
|
||||||
},
|
|
||||||
[](gcomponent<layout>& c, bool yesno){
|
|
||||||
if ( yesno ) {
|
|
||||||
layouts::mark_was_moved(c);
|
|
||||||
} else {
|
|
||||||
layouts::unmark_was_moved(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
),
|
|
||||||
|
|
||||||
"mode", sol::property(
|
"mode", sol::property(
|
||||||
[](const gcomponent<layout>& c) -> layout::modes {
|
[](const gcomponent<layout>& c) -> layout::modes {
|
||||||
return c->mode();
|
return c->mode();
|
||||||
|
|||||||
@@ -151,32 +151,6 @@ namespace e2d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace e2d
|
|
||||||
{
|
|
||||||
const char* factory_loader<layout::was_moved>::schema_source = R"json({
|
|
||||||
"type" : "object",
|
|
||||||
"required" : [],
|
|
||||||
"additionalProperties" : false,
|
|
||||||
"properties" : {}
|
|
||||||
})json";
|
|
||||||
|
|
||||||
bool factory_loader<layout::was_moved>::operator()(
|
|
||||||
layout::was_moved& component,
|
|
||||||
const fill_context& ctx) const
|
|
||||||
{
|
|
||||||
E2D_UNUSED(component, ctx);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool factory_loader<layout::was_moved>::operator()(
|
|
||||||
asset_dependencies& dependencies,
|
|
||||||
const collect_context& ctx) const
|
|
||||||
{
|
|
||||||
E2D_UNUSED(dependencies, ctx);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace e2d
|
namespace e2d
|
||||||
{
|
{
|
||||||
const char* component_inspector<layout>::title = ICON_FA_BARS " layout";
|
const char* component_inspector<layout>::title = ICON_FA_BARS " layout";
|
||||||
@@ -192,18 +166,6 @@ namespace e2d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
|
||||||
|
|
||||||
if ( bool was_moved = c.owner().component<layout::was_moved>().exists();
|
|
||||||
ImGui::Checkbox("was_moved", &was_moved) )
|
|
||||||
{
|
|
||||||
if ( was_moved ) {
|
|
||||||
layouts::mark_was_moved(c);
|
|
||||||
} else {
|
|
||||||
layouts::unmark_was_moved(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
if ( layout::modes mode = c->mode();
|
if ( layout::modes mode = c->mode();
|
||||||
@@ -290,24 +252,6 @@ namespace e2d::layouts
|
|||||||
return self.owner().component<layout::dirty>().exists();
|
return self.owner().component<layout::dirty>().exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
gcomponent<layout> mark_was_moved(gcomponent<layout> self) {
|
|
||||||
if ( self ) {
|
|
||||||
self.owner().component<layout::was_moved>().ensure();
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
gcomponent<layout> unmark_was_moved(gcomponent<layout> self) {
|
|
||||||
if ( self ) {
|
|
||||||
self.owner().component<layout::was_moved>().remove();
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_was_moved(const const_gcomponent<layout>& self) noexcept {
|
|
||||||
return self.owner().component<layout::was_moved>().exists();
|
|
||||||
}
|
|
||||||
|
|
||||||
gcomponent<layout> change_mode(gcomponent<layout> self, layout::modes value) {
|
gcomponent<layout> change_mode(gcomponent<layout> self, layout::modes value) {
|
||||||
if ( self ) {
|
if ( self ) {
|
||||||
self->mode(value);
|
self->mode(value);
|
||||||
|
|||||||
@@ -199,7 +199,6 @@ namespace e2d
|
|||||||
.register_component<label::dirty>("label.dirty")
|
.register_component<label::dirty>("label.dirty")
|
||||||
.register_component<layout>("layout")
|
.register_component<layout>("layout")
|
||||||
.register_component<layout::dirty>("layout.dirty")
|
.register_component<layout::dirty>("layout.dirty")
|
||||||
.register_component<layout::was_moved>("layout.was_moved")
|
|
||||||
.register_component<model_renderer>("model_renderer")
|
.register_component<model_renderer>("model_renderer")
|
||||||
.register_component<named>("named")
|
.register_component<named>("named")
|
||||||
.register_component<renderer>("renderer")
|
.register_component<renderer>("renderer")
|
||||||
@@ -226,7 +225,6 @@ namespace e2d
|
|||||||
//.register_component<label::dirty>("label.dirty")
|
//.register_component<label::dirty>("label.dirty")
|
||||||
.register_component<layout>("layout")
|
.register_component<layout>("layout")
|
||||||
//.register_component<layout::dirty>("layout.dirty")
|
//.register_component<layout::dirty>("layout.dirty")
|
||||||
//.register_component<layout::was_moved>("layout.was_moved")
|
|
||||||
.register_component<model_renderer>("model_renderer")
|
.register_component<model_renderer>("model_renderer")
|
||||||
.register_component<named>("named")
|
.register_component<named>("named")
|
||||||
.register_component<renderer>("renderer")
|
.register_component<renderer>("renderer")
|
||||||
|
|||||||
@@ -189,8 +189,6 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
void process_dirty_layouts(ecs::registry& owner) {
|
void process_dirty_layouts(ecs::registry& owner) {
|
||||||
owner.remove_all_components<layout::was_moved>();
|
|
||||||
|
|
||||||
owner.for_joined_components<layout::dirty, yogo_node, layout, actor>([](
|
owner.for_joined_components<layout::dirty, yogo_node, layout, actor>([](
|
||||||
const ecs::const_entity&,
|
const ecs::const_entity&,
|
||||||
const layout::dirty&,
|
const layout::dirty&,
|
||||||
@@ -240,8 +238,6 @@ namespace
|
|||||||
item_a->node()->translation(v2f(
|
item_a->node()->translation(v2f(
|
||||||
YGNodeLayoutGetLeft(item_yn->as_item.get()),
|
YGNodeLayoutGetLeft(item_yn->as_item.get()),
|
||||||
YGNodeLayoutGetTop(item_yn->as_item.get())));
|
YGNodeLayoutGetTop(item_yn->as_item.get())));
|
||||||
layouts::mark_was_moved(
|
|
||||||
item.owner().component<layout>());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user