diff --git a/headers/enduro2d/high/_high.hpp b/headers/enduro2d/high/_high.hpp index 62e10dd2..0653320c 100644 --- a/headers/enduro2d/high/_high.hpp +++ b/headers/enduro2d/high/_high.hpp @@ -108,7 +108,7 @@ namespace e2d::ecsex Opts&&... opts) { static thread_local vector to_remove_components; - DEFER([](){ to_remove_components.clear(); }); + DEFER_HPP([](){ to_remove_components.clear(); }); owner.for_each_component([](const ecs::entity& e, const T&){ to_remove_components.push_back(e); @@ -163,7 +163,7 @@ namespace e2d::ecsex std::tuple> components; const std::size_t begin_index = components.size(); - DEFER([begin_index](){ + DEFER_HPP([begin_index](){ components.erase( components.begin() + begin_index, components.end()); @@ -187,7 +187,7 @@ namespace e2d::ecsex std::tuple> components; const std::size_t begin_index = components.size(); - DEFER([begin_index](){ + DEFER_HPP([begin_index](){ components.erase( components.begin() + begin_index, components.end()); @@ -214,7 +214,7 @@ namespace e2d::ecsex std::tuple> components; const std::size_t begin_index = components.size(); - DEFER([begin_index](){ + DEFER_HPP([begin_index](){ components.erase( components.begin() + begin_index, components.end()); @@ -243,7 +243,7 @@ namespace e2d::ecsex std::tuple> components; const std::size_t begin_index = components.size(); - DEFER([begin_index](){ + DEFER_HPP([begin_index](){ components.erase( components.begin() + begin_index, components.end()); diff --git a/headers/enduro2d/high/inspector.inl b/headers/enduro2d/high/inspector.inl index ae2467b9..4a0c694c 100644 --- a/headers/enduro2d/high/inspector.inl +++ b/headers/enduro2d/high/inspector.inl @@ -82,7 +82,7 @@ namespace e2d::impl } ImGui::PushID(co.find()); - DEFER([](){ ImGui::PopID(); }); + DEFER_HPP([](){ ImGui::PopID(); }); const bool inspector_opened = ImGui::CollapsingHeader( component_inspector::title, @@ -90,7 +90,7 @@ namespace e2d::impl const char* component_popup_context_str_id = "e2d_component_popup_context"; if ( ImGui::BeginPopupContextItem(component_popup_context_str_id) ) { - DEFER([](){ ImGui::EndPopup(); }); + DEFER_HPP([](){ ImGui::EndPopup(); }); auto disabled_co = co.owner().template component>(); if ( bool enabled = !disabled_co; ImGui::Checkbox("Enabled", &enabled) ) { @@ -137,7 +137,7 @@ namespace e2d::impl } ImGui::PushID(co.find()); - DEFER([](){ ImGui::PopID(); }); + DEFER_HPP([](){ ImGui::PopID(); }); if ( !co.owner().template component>() ) { inspector_(co, ctx); diff --git a/headers/enduro2d/high/node.inl b/headers/enduro2d/high/node.inl index 53543315..8b271670 100644 --- a/headers/enduro2d/high/node.inl +++ b/headers/enduro2d/high/node.inl @@ -153,7 +153,7 @@ namespace e2d::nodes static thread_local vector> parents; const std::size_t begin_index = parents.size(); - DEFER([begin_index](){ + DEFER_HPP([begin_index](){ parents.erase( parents.begin() + begin_index, parents.end()); @@ -184,7 +184,7 @@ namespace e2d::nodes static thread_local vector> children; const std::size_t begin_index = children.size(); - DEFER([begin_index](){ + DEFER_HPP([begin_index](){ children.erase( children.begin() + begin_index, children.end()); @@ -253,7 +253,7 @@ namespace e2d::nodes static thread_local vector> components; const std::size_t begin_index = components.size(); - DEFER([begin_index](){ + DEFER_HPP([begin_index](){ components.erase( components.begin() + begin_index, components.end()); @@ -284,7 +284,7 @@ namespace e2d::nodes static thread_local vector> components; const std::size_t begin_index = components.size(); - DEFER([begin_index](){ + DEFER_HPP([begin_index](){ components.erase( components.begin() + begin_index, components.end()); diff --git a/headers/enduro2d/utils/imgui_utils.hpp b/headers/enduro2d/utils/imgui_utils.hpp index 9b4acdc4..5d3811f7 100644 --- a/headers/enduro2d/utils/imgui_utils.hpp +++ b/headers/enduro2d/utils/imgui_utils.hpp @@ -37,7 +37,7 @@ namespace e2d::imgui_utils template < typename... Args > void show_colored_text(const color& color, str_view fmt, Args&&... args) { ImGui::PushStyleColor(ImGuiCol_Text, make_vec4(color)); - DEFER([](){ ImGui::PopStyleColor(); }); + DEFER_HPP([](){ ImGui::PopStyleColor(); }); show_formatted_text(fmt, std::forward(args)...); } @@ -54,7 +54,7 @@ namespace e2d::imgui_utils } if ( ImGui::BeginCombo(label_cstr, preview_cstr) ) { - DEFER([](){ ImGui::EndCombo(); }); + DEFER_HPP([](){ ImGui::EndCombo(); }); for ( std::size_t i = 0; i < enum_hpp::size(); ++i ) { str_view item_name = enum_hpp::names()[i]; @@ -80,10 +80,10 @@ namespace e2d::imgui_utils template < typename F, typename... Args > void with_disabled_flag(F&& f, Args&&... args) { ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); - DEFER([](){ ImGui::PopItemFlag(); }); + DEFER_HPP([](){ ImGui::PopItemFlag(); }); ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f); - DEFER([](){ ImGui::PopStyleVar(); }); + DEFER_HPP([](){ ImGui::PopStyleVar(); }); std::invoke(std::forward(f), std::forward(args)...); } diff --git a/modules/defer.hpp b/modules/defer.hpp index 6ea555b9..e0467e5d 160000 --- a/modules/defer.hpp +++ b/modules/defer.hpp @@ -1 +1 @@ -Subproject commit 6ea555b98c58f002d843127186eeea4a905bb88c +Subproject commit e0467e5d0814ba6bb23b7e29cb9b1b7d6e1c04d3 diff --git a/modules/ecs.hpp b/modules/ecs.hpp index a32eb1c6..ab8a36f7 160000 --- a/modules/ecs.hpp +++ b/modules/ecs.hpp @@ -1 +1 @@ -Subproject commit a32eb1c602b2a659962cdabed33c69c8344750ac +Subproject commit ab8a36f7b2f68c8c922f71e9c7be4488a6444c23 diff --git a/modules/enum.hpp b/modules/enum.hpp index 3dea3449..f4b4b416 160000 --- a/modules/enum.hpp +++ b/modules/enum.hpp @@ -1 +1 @@ -Subproject commit 3dea3449e4860a4de3e094ae2fea89c90258e9bb +Subproject commit f4b4b4164e2da76ca58918b6c544c87189589d29 diff --git a/modules/flat.hpp b/modules/flat.hpp index 2a2b4458..bec8ee44 160000 --- a/modules/flat.hpp +++ b/modules/flat.hpp @@ -1 +1 @@ -Subproject commit 2a2b4458427a6f75ec75b62da8421877a25f8ad1 +Subproject commit bec8ee449b1b1cf5641c0cf6b94d6f1dcf131943 diff --git a/modules/promise.hpp b/modules/promise.hpp index 3cef25b1..60078b1e 160000 --- a/modules/promise.hpp +++ b/modules/promise.hpp @@ -1 +1 @@ -Subproject commit 3cef25b174d192b5e8db48efc8a00a3621805a99 +Subproject commit 60078b1e242467a3a3e39732f571b5fc4e8057b0 diff --git a/sources/enduro2d/core/dbgui_impl/dbgui.hpp b/sources/enduro2d/core/dbgui_impl/dbgui.hpp index f3c987e4..81dc0673 100644 --- a/sources/enduro2d/core/dbgui_impl/dbgui.hpp +++ b/sources/enduro2d/core/dbgui_impl/dbgui.hpp @@ -45,7 +45,7 @@ namespace e2d::imgex char* id_cstr = static_cast(E2D_CLEAR_ALLOCA(id.size() + 1)); std::memcpy(id_cstr, id.data(), id.size()); - if ( DEFER([](){ ImGui::EndChild(); }); + if ( DEFER_HPP([](){ ImGui::EndChild(); }); ImGui::BeginChild(id_cstr, ImVec2(0.f, 0.f), border, flags) ) { f(); @@ -58,7 +58,7 @@ namespace e2d::imgex std::memcpy(label_cstr, label.data(), label.size()); if ( ImGui::BeginMenu(label_cstr) ) { - DEFER([](){ ImGui::EndMenu(); }); + DEFER_HPP([](){ ImGui::EndMenu(); }); f(); } } @@ -66,7 +66,7 @@ namespace e2d::imgex template < typename F > void with_menu_bar(F&& f) { if ( ImGui::BeginMenuBar() ) { - DEFER([](){ ImGui::EndMenuBar(); }); + DEFER_HPP([](){ ImGui::EndMenuBar(); }); f(); } } @@ -77,7 +77,7 @@ namespace e2d::imgex std::memcpy(id_cstr, id.data(), id.size()); if ( ImGui::BeginPopup(id_cstr) ) { - DEFER([](){ ImGui::EndPopup(); }); + DEFER_HPP([](){ ImGui::EndPopup(); }); f(); } } @@ -87,7 +87,7 @@ namespace e2d::imgex char* name_cstr = static_cast(E2D_CLEAR_ALLOCA(name.size() + 1)); std::memcpy(name_cstr, name.data(), name.size()); - if ( DEFER([](){ ImGui::End(); }); + if ( DEFER_HPP([](){ ImGui::End(); }); ImGui::Begin(name_cstr, opened, flags) ) { f(); @@ -118,7 +118,7 @@ namespace e2d::imgex ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.f, 0.f)); ImGui::Begin("e2d_dock_space_window", nullptr, window_flags); - DEFER([](){ ImGui::End(); }); + DEFER_HPP([](){ ImGui::End(); }); ImGui::PopStyleVar(3); diff --git a/sources/enduro2d/core/dbgui_impl/widgets/input_widget.cpp b/sources/enduro2d/core/dbgui_impl/widgets/input_widget.cpp index 91aa81d6..6554ad41 100644 --- a/sources/enduro2d/core/dbgui_impl/widgets/input_widget.cpp +++ b/sources/enduro2d/core/dbgui_impl/widgets/input_widget.cpp @@ -34,7 +34,7 @@ namespace e2d::dbgui_widgets ImGui::Text("pressed keys:"); ImGui::Indent(); - DEFER([](){ ImGui::Unindent(); }); + DEFER_HPP([](){ ImGui::Unindent(); }); const vector pressed_keys = i.keyboard().pressed_keys(); for ( keyboard_key pk : pressed_keys ) { @@ -46,7 +46,7 @@ namespace e2d::dbgui_widgets ImGui::Text("pressed buttons:"); ImGui::Indent(); - DEFER([](){ ImGui::Unindent(); }); + DEFER_HPP([](){ ImGui::Unindent(); }); const vector pressed_buttons = i.mouse().pressed_buttons(); for ( mouse_button mb : pressed_buttons ) { diff --git a/sources/enduro2d/high/components/camera.cpp b/sources/enduro2d/high/components/camera.cpp index f115cfb3..bfb29fbb 100644 --- a/sources/enduro2d/high/components/camera.cpp +++ b/sources/enduro2d/high/components/camera.cpp @@ -220,7 +220,7 @@ namespace e2d } if ( ImGui::TreeNode("clipping") ) { - DEFER([](){ ImGui::TreePop(); }); + DEFER_HPP([](){ ImGui::TreePop(); }); if ( f32 znear = c->znear(); ImGui::DragFloat("znear", &znear, 1.f) ) @@ -240,7 +240,7 @@ namespace e2d ///TODO(BlackMat): add 'view' inspector if ( ImGui::TreeNode("viewport") ) { - DEFER([](){ ImGui::TreePop(); }); + DEFER_HPP([](){ ImGui::TreePop(); }); if ( b2f viewport = c->viewport(); ImGui::DragFloat2("position", viewport.position.data(), 0.01f) ) diff --git a/sources/enduro2d/high/components/colliders.cpp b/sources/enduro2d/high/components/colliders.cpp index e538a7cd..5c458fbd 100644 --- a/sources/enduro2d/high/components/colliders.cpp +++ b/sources/enduro2d/high/components/colliders.cpp @@ -221,7 +221,7 @@ namespace e2d c->points().size()); if ( ImGui::TreeNode(points_label.c_str()) ) { - DEFER([](){ ImGui::TreePop(); }); + DEFER_HPP([](){ ImGui::TreePop(); }); int count = math::numeric_cast(c->points().size()); if ( ImGui::DragInt("count", &count, 1.f, 0, std::numeric_limits::max()) ) { @@ -230,7 +230,7 @@ namespace e2d for ( std::size_t i = 0; i < c->points().size(); ++i ) { ImGui::PushID(math::numeric_cast(i)); - DEFER([](){ ImGui::PopID(); }); + DEFER_HPP([](){ ImGui::PopID(); }); if ( v2f point = c->points()[i]; ImGui::DragFloat2("###point", point.data(), 1.f) ) diff --git a/sources/enduro2d/high/inspector.cpp b/sources/enduro2d/high/inspector.cpp index 93dc4378..4302b10f 100644 --- a/sources/enduro2d/high/inspector.cpp +++ b/sources/enduro2d/high/inspector.cpp @@ -25,7 +25,7 @@ namespace e2d } if ( ImGui::BeginPopup(add_component_popup_str_id) ) { - DEFER([](){ ImGui::EndPopup(); }); + DEFER_HPP([](){ ImGui::EndPopup(); }); for ( const auto& p : inspector_impls_ ) { imgui_utils::with_disabled_flag_ex( diff --git a/sources/enduro2d/high/systems/gizmos_system.cpp b/sources/enduro2d/high/systems/gizmos_system.cpp index da537d98..549fec53 100644 --- a/sources/enduro2d/high/systems/gizmos_system.cpp +++ b/sources/enduro2d/high/systems/gizmos_system.cpp @@ -217,12 +217,12 @@ namespace ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.f, 0.f)); ImGui::Begin("e2d_gizmos_window", nullptr, window_flags); - DEFER([](){ ImGui::End(); }); + DEFER_HPP([](){ ImGui::End(); }); ImGui::PopStyleVar(3); ImGui::PushClipRect(clip_rect.Min, clip_rect.Max, true); - DEFER([](){ ImGui::PopClipRect(); }); + DEFER_HPP([](){ ImGui::PopClipRect(); }); std::invoke(std::forward(f), std::forward(args)...); } diff --git a/sources/enduro2d/high/systems/layout_system.cpp b/sources/enduro2d/high/systems/layout_system.cpp index 523336c9..a02a8de9 100644 --- a/sources/enduro2d/high/systems/layout_system.cpp +++ b/sources/enduro2d/high/systems/layout_system.cpp @@ -181,13 +181,13 @@ namespace const actor& root_a) { static thread_local vector> item_ws; - DEFER([](){ item_ws.clear(); }); + DEFER_HPP([](){ item_ws.clear(); }); nodes::extract_components_from_children( root_a.node(), std::back_inserter(item_ws)); - DEFER([&root_yn](){ + DEFER_HPP([&root_yn](){ YGNodeRemoveAllChildren(root_yn.as_root.get()); }); diff --git a/sources/enduro2d/high/systems/render_system_impl/render_system_batcher.hpp b/sources/enduro2d/high/systems/render_system_impl/render_system_batcher.hpp index e7074e90..9ec1870b 100644 --- a/sources/enduro2d/high/systems/render_system_impl/render_system_batcher.hpp +++ b/sources/enduro2d/high/systems/render_system_impl/render_system_batcher.hpp @@ -106,7 +106,7 @@ namespace e2d::render_system_impl flush(); } - ERROR_DEFER([this](){ + ERROR_DEFER_HPP([this](){ clear(false); }); @@ -143,7 +143,7 @@ namespace e2d::render_system_impl template < typename Index, typename Vertex > render::property_block& batcher::flush() { - DEFER([this](){ + DEFER_HPP([this](){ clear(false); }); @@ -179,7 +179,7 @@ namespace e2d::render_system_impl .indices(index_buffer_) .add_vertices(vertex_buffer_); - DEFER([this](){ + DEFER_HPP([this](){ property_cache_.clear(); }); diff --git a/sources/enduro2d/high/systems/render_system_impl/render_system_drawer.cpp b/sources/enduro2d/high/systems/render_system_impl/render_system_drawer.cpp index d70e3064..64ed0738 100644 --- a/sources/enduro2d/high/systems/render_system_impl/render_system_drawer.cpp +++ b/sources/enduro2d/high/systems/render_system_impl/render_system_drawer.cpp @@ -121,7 +121,7 @@ namespace e2d::render_system_impl const model& mdl = mdl_r.model()->content(); const mesh& msh = mdl.mesh()->content(); - DEFER([this](){ + DEFER_HPP([this](){ property_cache_.clear(); }); @@ -197,7 +197,7 @@ namespace e2d::render_system_impl return; } - DEFER([this](){ + DEFER_HPP([this](){ property_cache_.clear(); }); diff --git a/sources/enduro2d/high/systems/touch_system_impl/touch_system_colliders.cpp b/sources/enduro2d/high/systems/touch_system_impl/touch_system_colliders.cpp index c25c238e..6ace61b1 100644 --- a/sources/enduro2d/high/systems/touch_system_impl/touch_system_colliders.cpp +++ b/sources/enduro2d/high/systems/touch_system_impl/touch_system_colliders.cpp @@ -126,7 +126,7 @@ namespace e2d::touch_system_impl::impl const b2f& camera_viewport) { static thread_local std::vector points; - DEFER([](){ points.clear(); }); + DEFER_HPP([](){ points.clear(); }); if ( points.capacity() < c.points.size() ) { points.reserve(math::max(points.capacity() * 2u, c.points.size())); diff --git a/sources/enduro2d/high/systems/touch_system_impl/touch_system_dispatcher.cpp b/sources/enduro2d/high/systems/touch_system_impl/touch_system_dispatcher.cpp index 0ab97623..54f47992 100644 --- a/sources/enduro2d/high/systems/touch_system_impl/touch_system_dispatcher.cpp +++ b/sources/enduro2d/high/systems/touch_system_impl/touch_system_dispatcher.cpp @@ -17,7 +17,7 @@ namespace scene, actor>> scenes; - DEFER([](){ scenes.clear(); }); + DEFER_HPP([](){ scenes.clear(); }); ecsex::extract_components( owner, std::back_inserter(scenes), @@ -62,7 +62,7 @@ namespace // static thread_local std::vector> parents; - DEFER([](){ parents.clear(); }); + DEFER_HPP([](){ parents.clear(); }); nodes::extract_components_from_parents( target_actor->node(), @@ -115,7 +115,7 @@ namespace namespace e2d::touch_system_impl { void dispatcher::dispatch_all_events(ecs::registry& owner) { - DEFER([this](){ events_.clear(); }); + DEFER_HPP([this](){ events_.clear(); }); owner.for_each_component>([ ](const ecs::const_entity&, events& es) { diff --git a/sources/enduro2d/high/widgets/hierarchy_widget.cpp b/sources/enduro2d/high/widgets/hierarchy_widget.cpp index 4275f958..e48af05a 100644 --- a/sources/enduro2d/high/widgets/hierarchy_widget.cpp +++ b/sources/enduro2d/high/widgets/hierarchy_widget.cpp @@ -38,7 +38,7 @@ namespace : strings::rformat("%0 %1", icon_name, component_name); ImGui::PushID(root.get()); - DEFER([](){ ImGui::PopID(); }); + DEFER_HPP([](){ ImGui::PopID(); }); ImGuiTreeNodeFlags tree_node_flags = ImGuiTreeNodeFlags_OpenOnArrow | @@ -58,7 +58,7 @@ namespace tree_node_flags, "%s", tree_node_name.c_str()); - DEFER([tree_node_opened](){ + DEFER_HPP([tree_node_opened](){ if ( tree_node_opened ) { ImGui::TreePop(); } @@ -73,7 +73,7 @@ namespace } if ( ImGui::BeginPopupContextItem() ) { - DEFER([](){ ImGui::EndPopup(); }); + DEFER_HPP([](){ ImGui::EndPopup(); }); if ( ImGui::MenuItem("Add child") ) { gobject inst = w.instantiate(); diff --git a/sources/enduro2d/high/world.cpp b/sources/enduro2d/high/world.cpp index e2343351..acb0a4aa 100644 --- a/sources/enduro2d/high/world.cpp +++ b/sources/enduro2d/high/world.cpp @@ -91,7 +91,7 @@ namespace }); gobject root_i(make_intrusive(world, ent)); - ERROR_DEFER([&root_i](){ + ERROR_DEFER_HPP([&root_i](){ delete_instance(root_i); }); @@ -108,7 +108,7 @@ namespace for ( const prefab& child_prefab : root_prefab.children() ) { gobject child_i = new_instance(world, child_prefab); - ERROR_DEFER([&child_i](){ + ERROR_DEFER_HPP([&child_i](){ delete_instance(child_i); }); gcomponent root_a{root_i}; @@ -158,7 +158,7 @@ namespace e2d gobject world::instantiate(const prefab& prefab, const node_iptr& parent) { gobject inst = new_instance(*this, prefab); - ERROR_DEFER([inst](){ + ERROR_DEFER_HPP([inst](){ delete_instance(inst); }); @@ -173,7 +173,7 @@ namespace e2d gobject world::instantiate(const prefab& prefab, const node_iptr& parent, const t2f& transform) { gobject inst = new_instance(*this, prefab); - ERROR_DEFER([inst](){ + ERROR_DEFER_HPP([inst](){ delete_instance(inst); }); diff --git a/untests/sources/untests_utils/filesystem.cpp b/untests/sources/untests_utils/filesystem.cpp index 99fa4606..ae322480 100644 --- a/untests/sources/untests_utils/filesystem.cpp +++ b/untests/sources/untests_utils/filesystem.cpp @@ -8,7 +8,7 @@ using namespace e2d; TEST_CASE("filesystem") { - DEFER([](){ + DEFER_HPP([](){ filesystem::remove_file("files_test"); }); SECTION("files") { diff --git a/untests/sources/untests_utils/image.cpp b/untests/sources/untests_utils/image.cpp index 8234fe05..cb68d6aa 100644 --- a/untests/sources/untests_utils/image.cpp +++ b/untests/sources/untests_utils/image.cpp @@ -8,7 +8,7 @@ using namespace e2d; TEST_CASE("images") { - DEFER([](){ + DEFER_HPP([](){ filesystem::remove_file("image_save_test.jpg"); filesystem::remove_file("image_save_test.png"); filesystem::remove_file("image_save_test.tga");