From 6dbb4bbed05506ed42bbcf0994cbc700cba89fad Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Thu, 13 Feb 2020 14:01:08 +0700 Subject: [PATCH] was_moved flag is removed because it's not used --- headers/enduro2d/high/components/layout.hpp | 19 ------- samples/bin/library/scenes/sample_09.json | 9 +++ .../scripts/emmy/components/layout.lua | 3 - .../high_binds/components/layout_binds.cpp | 13 ----- sources/enduro2d/high/components/layout.cpp | 56 ------------------- sources/enduro2d/high/starter.cpp | 2 - .../enduro2d/high/systems/layout_system.cpp | 4 -- 7 files changed, 9 insertions(+), 97 deletions(-) diff --git a/headers/enduro2d/high/components/layout.hpp b/headers/enduro2d/high/components/layout.hpp index c283f414..29c04b07 100644 --- a/headers/enduro2d/high/components/layout.hpp +++ b/headers/enduro2d/high/components/layout.hpp @@ -13,7 +13,6 @@ namespace e2d class layout final { public: class dirty final {}; - class was_moved final {}; public: ENUM_HPP_CLASS_DECL(modes, u8, (horizontal) @@ -98,20 +97,6 @@ namespace e2d asset_dependencies& dependencies, const collect_context& ctx) const; }; - - template <> - class factory_loader 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 @@ -189,10 +174,6 @@ namespace e2d::layouts gcomponent unmark_dirty(gcomponent self); bool is_dirty(const const_gcomponent& self) noexcept; - gcomponent mark_was_moved(gcomponent self); - gcomponent unmark_was_moved(gcomponent self); - bool is_was_moved(const const_gcomponent& self) noexcept; - gcomponent change_mode(gcomponent self, layout::modes value); gcomponent change_halign(gcomponent self, layout::haligns value); gcomponent change_valign(gcomponent self, layout::valigns value); diff --git a/samples/bin/library/scenes/sample_09.json b/samples/bin/library/scenes/sample_09.json index bbda2da8..fda74e0f 100644 --- a/samples/bin/library/scenes/sample_09.json +++ b/samples/bin/library/scenes/sample_09.json @@ -6,6 +6,15 @@ "prototype" : "../prefabs/camera_prefab.json" },{ "prototype" : "../prefabs/layout_prefab.json", + "components" : { + "actor" : { + "translation" : [-250,0] + }, + "layout" : { + "size" : [500,200], + "halign" : "space_evenly" + } + }, "children" : [{ "prototype" : "../prefabs/layout_prefab.json", "components" : { diff --git a/samples/bin/library/scripts/emmy/components/layout.lua b/samples/bin/library/scripts/emmy/components/layout.lua index d489f076..3722fb64 100644 --- a/samples/bin/library/scripts/emmy/components/layout.lua +++ b/samples/bin/library/scripts/emmy/components/layout.lua @@ -9,9 +9,6 @@ local layout = { ---@type boolean dirty = false, - ---@type boolean - was_moved = false, - ---@type layout_modes mode = layout.modes.horizontal, 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 b780cc68..8cc128fa 100644 --- a/sources/enduro2d/high/bindings/high_binds/components/layout_binds.cpp +++ b/sources/enduro2d/high/bindings/high_binds/components/layout_binds.cpp @@ -67,19 +67,6 @@ namespace e2d::bindings::high } ), - "was_moved", sol::property( - [](const gcomponent& c) -> bool { - return layouts::is_was_moved(c); - }, - [](gcomponent& c, bool yesno){ - if ( yesno ) { - layouts::mark_was_moved(c); - } else { - layouts::unmark_was_moved(c); - } - } - ), - "mode", sol::property( [](const gcomponent& c) -> layout::modes { return c->mode(); diff --git a/sources/enduro2d/high/components/layout.cpp b/sources/enduro2d/high/components/layout.cpp index 3de05e66..cafadbde 100644 --- a/sources/enduro2d/high/components/layout.cpp +++ b/sources/enduro2d/high/components/layout.cpp @@ -151,32 +151,6 @@ namespace e2d } } -namespace e2d -{ - const char* factory_loader::schema_source = R"json({ - "type" : "object", - "required" : [], - "additionalProperties" : false, - "properties" : {} - })json"; - - bool factory_loader::operator()( - layout::was_moved& component, - const fill_context& ctx) const - { - E2D_UNUSED(component, ctx); - return true; - } - - bool factory_loader::operator()( - asset_dependencies& dependencies, - const collect_context& ctx) const - { - E2D_UNUSED(dependencies, ctx); - return true; - } -} - namespace e2d { const char* component_inspector::title = ICON_FA_BARS " layout"; @@ -192,18 +166,6 @@ namespace e2d } } - ImGui::SameLine(); - - if ( bool was_moved = c.owner().component().exists(); - ImGui::Checkbox("was_moved", &was_moved) ) - { - if ( was_moved ) { - layouts::mark_was_moved(c); - } else { - layouts::unmark_was_moved(c); - } - } - ImGui::Separator(); if ( layout::modes mode = c->mode(); @@ -290,24 +252,6 @@ namespace e2d::layouts return self.owner().component().exists(); } - gcomponent mark_was_moved(gcomponent self) { - if ( self ) { - self.owner().component().ensure(); - } - return self; - } - - gcomponent unmark_was_moved(gcomponent self) { - if ( self ) { - self.owner().component().remove(); - } - return self; - } - - bool is_was_moved(const const_gcomponent& self) noexcept { - return self.owner().component().exists(); - } - gcomponent change_mode(gcomponent self, layout::modes value) { if ( self ) { self->mode(value); diff --git a/sources/enduro2d/high/starter.cpp b/sources/enduro2d/high/starter.cpp index 0475cc95..503a8837 100644 --- a/sources/enduro2d/high/starter.cpp +++ b/sources/enduro2d/high/starter.cpp @@ -199,7 +199,6 @@ namespace e2d .register_component("label.dirty") .register_component("layout") .register_component("layout.dirty") - .register_component("layout.was_moved") .register_component("model_renderer") .register_component("named") .register_component("renderer") @@ -226,7 +225,6 @@ namespace e2d //.register_component("label.dirty") .register_component("layout") //.register_component("layout.dirty") - //.register_component("layout.was_moved") .register_component("model_renderer") .register_component("named") .register_component("renderer") diff --git a/sources/enduro2d/high/systems/layout_system.cpp b/sources/enduro2d/high/systems/layout_system.cpp index 0b4f7bdb..b6ff3ad6 100644 --- a/sources/enduro2d/high/systems/layout_system.cpp +++ b/sources/enduro2d/high/systems/layout_system.cpp @@ -189,8 +189,6 @@ namespace } void process_dirty_layouts(ecs::registry& owner) { - owner.remove_all_components(); - owner.for_joined_components([]( const ecs::const_entity&, const layout::dirty&, @@ -240,8 +238,6 @@ namespace item_a->node()->translation(v2f( YGNodeLayoutGetLeft(item_yn->as_item.get()), YGNodeLayoutGetTop(item_yn->as_item.get()))); - layouts::mark_was_moved( - item.owner().component()); } } });