Thin app runtime and generic node shells

This commit is contained in:
2026-06-17 00:24:00 +02:00
parent 86e57d47ad
commit 9b1e593477
9 changed files with 377 additions and 264 deletions

View File

@@ -82,13 +82,13 @@ Current hotspot files:
- `src/canvas.cpp`: 17 lines - `src/canvas.cpp`: 17 lines
- `src/app_layout.cpp`: 125 lines - `src/app_layout.cpp`: 125 lines
- `src/canvas_modes.cpp`: 1 line - `src/canvas_modes.cpp`: 1 line
- `src/node.cpp`: 231 lines - `src/node.cpp`: 12 lines
- `src/main.cpp`: 87 lines - `src/main.cpp`: 87 lines
- `src/node_panel_brush.cpp`: 2 lines - `src/node_panel_brush.cpp`: 2 lines
- `src/node_stroke_preview.cpp`: 160 lines - `src/node_stroke_preview.cpp`: 160 lines
- `src/node_canvas.cpp`: 85 lines - `src/node_canvas.cpp`: 85 lines
- `src/app.cpp`: 125 lines - `src/app.cpp`: 94 lines
- `src/app_dialogs.cpp`: 127 lines - `src/app_dialogs.cpp`: 95 lines
Latest slice: Latest slice:
@@ -141,6 +141,18 @@ Latest slice:
- The entire `CanvasModeGrid` implementation plus `ActionModeGrid` undo/redo - The entire `CanvasModeGrid` implementation plus `ActionModeGrid` undo/redo
glue now live in `src/legacy_canvas_mode_helpers.cpp` instead of glue now live in `src/legacy_canvas_mode_helpers.cpp` instead of
`src/canvas_modes.cpp`, leaving `src/canvas_modes.cpp` as a minimal shell. `src/canvas_modes.cpp`, leaving `src/canvas_modes.cpp` as a minimal shell.
- `App::request_close()`, the RenderDoc frame wrappers, and the render/UI
thread entrypoint wrappers now route through
`src/legacy_app_runtime_shell_services.*` instead of staying inline in
`src/app.cpp`, leaving `app.cpp` as a thinner retained app shell.
- `App::show_progress()`, `App::message_box()`, and `App::input_box()` now
route through `src/legacy_app_dialog_services.*` instead of building dialog
plans and factories inline in `src/app_dialogs.cpp`.
- The remaining generic `Node` event/capture/resize shell plus the
width/height/padding/margin/flex/visibility/geometry wrappers now live in
`src/legacy_ui_node_execution.cpp` and `src/legacy_ui_node_style.*` instead
of staying inline in `src/node.cpp`, leaving `node.cpp` as a near-trivial
attribute/load shell.
Current architecture mismatches that must be treated as real blockers: Current architecture mismatches that must be treated as real blockers:

View File

@@ -590,6 +590,11 @@ Current slice:
keeping that shell pocket inline in `src/app.cpp`, which trims the live app keeping that shell pocket inline in `src/app.cpp`, which trims the live app
entry file a little further while preserving the retained open-action entry file a little further while preserving the retained open-action
behavior. behavior.
- `App::show_progress(...)`, `App::message_box(...)`, and
`App::input_box(...)` now also route through
`src/legacy_app_dialog_services.*` instead of building dialog plans and
factories inline in `src/app_dialogs.cpp`, which trims another coherent
dialog-construction pocket from the remaining app dialog shell.
Write scope: Write scope:
- `src/app_dialogs.cpp` - `src/app_dialogs.cpp`
@@ -651,6 +656,11 @@ Current slice:
live in `src/legacy_app_runtime_shell_services.cpp` instead of staying live in `src/legacy_app_runtime_shell_services.cpp` instead of staying
inline in `src/app.cpp`, which reduces the remaining app file to a thinner inline in `src/app.cpp`, which reduces the remaining app file to a thinner
retained shell around document routing and runtime thread entrypoints. retained shell around document routing and runtime thread entrypoints.
- `App::request_close()`, `App::renderdoc_frame_start()`,
`App::renderdoc_frame_end()`, and the render/UI thread entrypoint wrappers
now also route through `src/legacy_app_runtime_shell_services.*` instead of
staying inline in `src/app.cpp`, which reduces the live app file to a much
thinner retained composition shell.
Write scope: Write scope:
- `src/app.cpp` - `src/app.cpp`
@@ -754,6 +764,10 @@ Current slice:
- canvas async import/export/save/open background work now also runs through an - canvas async import/export/save/open background work now also runs through an
`AppRuntime`-owned worker queue instead of a retained static worker in `AppRuntime`-owned worker queue instead of a retained static worker in
`src/canvas.cpp` `src/canvas.cpp`
- `App::request_close()` plus the render/UI thread entrypoint wrappers now
also route through `src/legacy_app_runtime_shell_services.*`, which further
reduces direct runtime orchestration living on `src/app.cpp` even though the
owned runtime contract is still centered on `AppRuntime`
- retained `App` composition, task call sites, and platform/runtime entrypoint - retained `App` composition, task call sites, and platform/runtime entrypoint
coupling are still not fully reduced behind the runtime contract coupling are still not fully reduced behind the runtime contract
@@ -916,6 +930,11 @@ Current slice:
`load_legacy_ui_node(...)` in `src/legacy_ui_node_loader.*`, which moves the `load_legacy_ui_node(...)` in `src/legacy_ui_node_loader.*`, which moves the
init/attribute-parse/create/child-load/loaded shell out of `src/node.cpp` init/attribute-parse/create/child-load/loaded shell out of `src/node.cpp`
and leaves the remaining live node file thinner. and leaves the remaining live node file thinner.
- The remaining default `Node` event/capture/resize shell now also lives in
`src/legacy_ui_node_execution.cpp`, while the remaining
width/height/padding/margin/flex/visibility/geometry wrappers now also live
in `src/legacy_ui_node_style.*`, which reduces `src/node.cpp` to the final
attribute/load entrypoints without changing the public surface.
Write scope: Write scope:
- `src/node.cpp` - `src/node.cpp`

View File

@@ -14,10 +14,9 @@
#include "app_core/document_cloud.h" #include "app_core/document_cloud.h"
#include "app_core/document_recording.h" #include "app_core/document_recording.h"
#include "app_core/document_route.h" #include "app_core/document_route.h"
#include "app_core/document_session.h" #include "legacy_app_runtime_shell_services.h"
#include "legacy_app_startup_services.h" #include "legacy_app_startup_services.h"
#include "legacy_document_open_services.h" #include "legacy_document_open_services.h"
#include "legacy_document_session_services.h"
#include "legacy_preference_storage.h" #include "legacy_preference_storage.h"
#include "platform_api/platform_services.h" #include "platform_api/platform_services.h"
@@ -40,18 +39,7 @@ void App::open_document(std::string path)
bool App::request_close() bool App::request_close()
{ {
static bool dialog_already_opened = false; return pp::panopainter::execute_legacy_app_request_close(*this);
const auto close_decision = pp::app::plan_close_request(
Canvas::I->m_unsaved,
dialog_already_opened);
const auto status = pp::panopainter::execute_legacy_close_request_decision(
*this,
close_decision,
dialog_already_opened);
if (!status.ok())
LOG("Close request action failed: %s", status.message);
return close_decision == pp::app::CloseRequestDecision::close_now;
} }
void App::initAssets() void App::initAssets()
@@ -81,45 +69,45 @@ bool App::update_ui_observer(Node *n)
void App::renderdoc_frame_start() void App::renderdoc_frame_start()
{ {
begin_render_capture_frame(); pp::panopainter::execute_legacy_app_renderdoc_frame_start(*this);
} }
void App::renderdoc_frame_end() void App::renderdoc_frame_end()
{ {
end_render_capture_frame(); pp::panopainter::execute_legacy_app_renderdoc_frame_end(*this);
} }
void App::render_thread_main() void App::render_thread_main()
{ {
runtime_.render_thread_main(*this, {}); pp::panopainter::execute_legacy_app_render_thread_main(*this);
} }
void App::ui_thread_tick() void App::ui_thread_tick()
{ {
runtime_.ui_thread_tick(*this); pp::panopainter::execute_legacy_app_ui_thread_tick(*this);
} }
void App::ui_thread_main() void App::ui_thread_main()
{ {
runtime_.ui_thread_main(*this, {}); pp::panopainter::execute_legacy_app_ui_thread_main(*this);
} }
void App::render_thread_start() void App::render_thread_start()
{ {
runtime_.render_thread_start(*this); pp::panopainter::execute_legacy_app_render_thread_start(*this);
} }
void App::render_thread_stop() void App::render_thread_stop()
{ {
runtime_.render_thread_stop(); pp::panopainter::execute_legacy_app_render_thread_stop(*this);
} }
void App::ui_thread_start() void App::ui_thread_start()
{ {
runtime_.ui_thread_start(*this); pp::panopainter::execute_legacy_app_ui_thread_start(*this);
} }
void App::ui_thread_stop() void App::ui_thread_stop()
{ {
runtime_.ui_thread_stop(); pp::panopainter::execute_legacy_app_ui_thread_stop(*this);
} }

View File

@@ -1,9 +1,13 @@
#include "pch.h" #include "pch.h"
#include "legacy_app_runtime_shell_services.h"
#include "app.h" #include "app.h"
#include "app_core/app_frame.h" #include "app_core/app_frame.h"
#include "app_core/app_shutdown.h" #include "app_core/app_shutdown.h"
#include "app_core/app_status.h" #include "app_core/app_status.h"
#include "app_core/document_session.h"
#include "legacy_document_session_services.h"
#include "legacy_recording_services.h" #include "legacy_recording_services.h"
#include "legacy_ui_gl_dispatch.h" #include "legacy_ui_gl_dispatch.h"
#include "renderer_gl/opengl_capabilities.h" #include "renderer_gl/opengl_capabilities.h"
@@ -41,6 +45,67 @@ void update_legacy_recording_frame_label(App& app);
bool update_legacy_app_ui_observer(App& app, Node* n); bool update_legacy_app_ui_observer(App& app, Node* n);
void watch_legacy_app_ui_children(App& app, const std::function<bool(Node*)>& observer, bool skip_first_main_child); void watch_legacy_app_ui_children(App& app, const std::function<bool(Node*)>& observer, bool skip_first_main_child);
void update_legacy_canvas_toolbar(App& app); void update_legacy_canvas_toolbar(App& app);
bool execute_legacy_app_request_close(App& app)
{
static bool dialog_already_opened = false;
const auto close_decision = pp::app::plan_close_request(
Canvas::I->m_unsaved,
dialog_already_opened);
const auto status = pp::panopainter::execute_legacy_close_request_decision(
app,
close_decision,
dialog_already_opened);
if (!status.ok())
LOG("Close request action failed: %s", status.message);
return close_decision == pp::app::CloseRequestDecision::close_now;
}
void execute_legacy_app_renderdoc_frame_start(App& app)
{
app.begin_render_capture_frame();
}
void execute_legacy_app_renderdoc_frame_end(App& app)
{
app.end_render_capture_frame();
}
void execute_legacy_app_render_thread_main(App& app)
{
app.runtime().render_thread_main(app, {});
}
void execute_legacy_app_render_thread_start(App& app)
{
app.runtime().render_thread_start(app);
}
void execute_legacy_app_render_thread_stop(App& app)
{
app.runtime().render_thread_stop();
}
void execute_legacy_app_ui_thread_tick(App& app)
{
app.runtime().ui_thread_tick(app);
}
void execute_legacy_app_ui_thread_main(App& app)
{
app.runtime().ui_thread_main(app, {});
}
void execute_legacy_app_ui_thread_start(App& app)
{
app.runtime().ui_thread_start(app);
}
void execute_legacy_app_ui_thread_stop(App& app)
{
app.runtime().ui_thread_stop();
}
} // namespace pp::panopainter } // namespace pp::panopainter
void App::draw(float dt) void App::draw(float dt)

View File

@@ -0,0 +1,18 @@
#pragma once
class App;
namespace pp::panopainter {
[[nodiscard]] bool execute_legacy_app_request_close(App& app);
void execute_legacy_app_renderdoc_frame_start(App& app);
void execute_legacy_app_renderdoc_frame_end(App& app);
void execute_legacy_app_render_thread_main(App& app);
void execute_legacy_app_render_thread_start(App& app);
void execute_legacy_app_render_thread_stop(App& app);
void execute_legacy_app_ui_thread_tick(App& app);
void execute_legacy_app_ui_thread_main(App& app);
void execute_legacy_app_ui_thread_start(App& app);
void execute_legacy_app_ui_thread_stop(App& app);
} // namespace pp::panopainter

View File

@@ -1,7 +1,48 @@
#include "pch.h" #include "pch.h"
#include "legacy_ui_node_event.h"
#include "app.h" #include "app.h"
#include "node.h" #include "node.h"
kEventResult Node::on_event(Event* e)
{
return pp::panopainter::handle_legacy_ui_node_event(*this, e);
}
kEventResult Node::handle_event(Event* e)
{
return kEventResult::Available;
}
void Node::handle_resize(glm::vec2 old_size, glm::vec2 new_size, float zoom)
{
}
void Node::handle_parent_resize(glm::vec2 old_size, glm::vec2 new_size)
{
}
void Node::mouse_capture()
{
pp::panopainter::legacy_ui_node_mouse_capture(*this);
}
void Node::mouse_release()
{
pp::panopainter::legacy_ui_node_mouse_release(*this);
}
void Node::key_capture()
{
pp::panopainter::legacy_ui_node_key_capture(*this);
}
void Node::key_release()
{
pp::panopainter::legacy_ui_node_key_release(*this);
}
void Node::restore_context() void Node::restore_context()
{ {
for (auto& c : m_children) for (auto& c : m_children)

View File

@@ -179,6 +179,31 @@ void legacy_ui_node_set_position(Node& node, glm::vec2 value)
node.app_redraw(); node.app_redraw();
} }
float legacy_ui_node_get_width(const Node& node)
{
return YGNodeLayoutGetWidth(node.y_node);
}
float legacy_ui_node_get_height(const Node& node)
{
return YGNodeLayoutGetHeight(node.y_node);
}
glm::vec2 legacy_ui_node_get_position(const Node& node)
{
return { YGNodeLayoutGetLeft(node.y_node), YGNodeLayoutGetTop(node.y_node) };
}
glm::vec2 legacy_ui_node_get_size(const Node& node)
{
return { legacy_ui_node_get_width(node), legacy_ui_node_get_height(node) };
}
YGDirection legacy_ui_node_get_rtl(const Node& node)
{
return YGNodeStyleGetDirection(node.y_node);
}
void legacy_ui_node_set_flex_grow(Node& node, float value) void legacy_ui_node_set_flex_grow(Node& node, float value)
{ {
YGNodeStyleSetFlexGrow(node.y_node, value); YGNodeStyleSetFlexGrow(node.y_node, value);
@@ -269,24 +294,9 @@ void legacy_ui_node_set_visibility(Node& node, bool visible)
node.app_redraw(); node.app_redraw();
} }
glm::vec2 legacy_ui_node_get_position(const Node& node) void legacy_ui_node_toggle_visibility(Node& node)
{ {
return { YGNodeLayoutGetLeft(node.y_node), YGNodeLayoutGetTop(node.y_node) }; node.SetVisibility(!node.m_display);
}
float legacy_ui_node_get_width(const Node& node)
{
return YGNodeLayoutGetWidth(node.y_node);
}
float legacy_ui_node_get_height(const Node& node)
{
return YGNodeLayoutGetHeight(node.y_node);
}
YGDirection legacy_ui_node_get_rtl(const Node& node)
{
return YGNodeStyleGetDirection(node.y_node);
} }
} // namespace pp::panopainter } // namespace pp::panopainter
@@ -325,3 +335,178 @@ void Node::SetPosition(const glm::vec2 pos)
{ {
pp::panopainter::legacy_ui_node_set_position(*this, pos); pp::panopainter::legacy_ui_node_set_position(*this, pos);
} }
void Node::SetWidth(float value)
{
pp::panopainter::legacy_ui_node_set_width(*this, value);
}
void Node::SetWidthP(float value)
{
pp::panopainter::legacy_ui_node_set_width_percent(*this, value);
}
void Node::SetHeight(float value)
{
pp::panopainter::legacy_ui_node_set_height(*this, value);
}
void Node::SetHeightP(float value)
{
pp::panopainter::legacy_ui_node_set_height_percent(*this, value);
}
void Node::SetMaxWidth(float value)
{
pp::panopainter::legacy_ui_node_set_max_width(*this, value);
}
void Node::SetMaxWidthP(float value)
{
pp::panopainter::legacy_ui_node_set_max_width_percent(*this, value);
}
void Node::SetMaxHeight(float value)
{
pp::panopainter::legacy_ui_node_set_max_height(*this, value);
}
void Node::SetMaxHeightP(float value)
{
pp::panopainter::legacy_ui_node_set_max_height_percent(*this, value);
}
void Node::SetMinWidth(float value)
{
pp::panopainter::legacy_ui_node_set_min_width(*this, value);
}
void Node::SetMinWidthP(float value)
{
pp::panopainter::legacy_ui_node_set_min_width_percent(*this, value);
}
void Node::SetMinHeight(float value)
{
pp::panopainter::legacy_ui_node_set_min_height(*this, value);
}
void Node::SetMinHeightP(float value)
{
pp::panopainter::legacy_ui_node_set_min_height_percent(*this, value);
}
void Node::SetPadding(float t, float r, float b, float l)
{
pp::panopainter::legacy_ui_node_set_padding(*this, t, r, b, l);
}
glm::vec4 Node::GetPadding() const
{
return pp::panopainter::legacy_ui_node_get_padding(*this);
}
void Node::SetMargin(float t, float r, float b, float l)
{
pp::panopainter::legacy_ui_node_set_margin(*this, t, r, b, l);
}
glm::vec4 Node::GetMargin() const
{
return pp::panopainter::legacy_ui_node_get_margin(*this);
}
void Node::SetPosition(float l, float t)
{
pp::panopainter::legacy_ui_node_set_position(*this, l, t);
}
void Node::SetPosition(float l, float t, float r, float b)
{
pp::panopainter::legacy_ui_node_set_position(*this, l, t, r, b);
}
void Node::SetFlexGrow(float value)
{
pp::panopainter::legacy_ui_node_set_flex_grow(*this, value);
}
void Node::SetFlexShrink(float value)
{
pp::panopainter::legacy_ui_node_set_flex_shrink(*this, value);
}
void Node::SetFlexDir(YGFlexDirection value)
{
pp::panopainter::legacy_ui_node_set_flex_dir(*this, value);
}
void Node::SetFlexWrap(YGWrap value)
{
pp::panopainter::legacy_ui_node_set_flex_wrap(*this, value);
}
void Node::SetJustify(YGJustify value)
{
pp::panopainter::legacy_ui_node_set_justify(*this, value);
}
void Node::SetAlign(YGAlign value)
{
pp::panopainter::legacy_ui_node_set_align(*this, value);
}
void Node::SetPositioning(YGPositionType value)
{
pp::panopainter::legacy_ui_node_set_positioning(*this, value);
}
void Node::SetAspectRatio(float ar)
{
pp::panopainter::legacy_ui_node_set_aspect_ratio(*this, ar);
}
void Node::SetRTL(YGDirection dir)
{
pp::panopainter::legacy_ui_node_set_rtl(*this, dir);
}
bool Node::GetVisibility()
{
return pp::panopainter::legacy_ui_node_get_visibility(*this);
}
void Node::SetVisibility(bool visible)
{
pp::panopainter::legacy_ui_node_set_visibility(*this, visible);
}
void Node::ToggleVisibility()
{
pp::panopainter::legacy_ui_node_toggle_visibility(*this);
}
glm::vec2 Node::GetPosition()
{
return pp::panopainter::legacy_ui_node_get_position(*this);
}
float Node::GetWidth()
{
return pp::panopainter::legacy_ui_node_get_width(*this);
}
float Node::GetHeight()
{
return pp::panopainter::legacy_ui_node_get_height(*this);
}
glm::vec2 Node::GetSize()
{
return pp::panopainter::legacy_ui_node_get_size(*this);
}
YGDirection Node::GetRTL()
{
return pp::panopainter::legacy_ui_node_get_rtl(*this);
}

View File

@@ -33,6 +33,11 @@ glm::vec4 legacy_ui_node_get_margin(const Node& node);
void legacy_ui_node_set_position(Node& node, float l, float t); void legacy_ui_node_set_position(Node& node, float l, float t);
void legacy_ui_node_set_position(Node& node, float l, float t, float r, float b); void legacy_ui_node_set_position(Node& node, float l, float t, float r, float b);
void legacy_ui_node_set_position(Node& node, glm::vec2 value); void legacy_ui_node_set_position(Node& node, glm::vec2 value);
float legacy_ui_node_get_width(const Node& node);
float legacy_ui_node_get_height(const Node& node);
glm::vec2 legacy_ui_node_get_position(const Node& node);
glm::vec2 legacy_ui_node_get_size(const Node& node);
YGDirection legacy_ui_node_get_rtl(const Node& node);
void legacy_ui_node_set_flex_grow(Node& node, float value); void legacy_ui_node_set_flex_grow(Node& node, float value);
void legacy_ui_node_set_flex_shrink(Node& node, float value); void legacy_ui_node_set_flex_shrink(Node& node, float value);
void legacy_ui_node_set_flex_dir(Node& node, YGFlexDirection value); void legacy_ui_node_set_flex_dir(Node& node, YGFlexDirection value);
@@ -44,9 +49,6 @@ void legacy_ui_node_set_aspect_ratio(Node& node, float ar);
void legacy_ui_node_set_rtl(Node& node, YGDirection dir); void legacy_ui_node_set_rtl(Node& node, YGDirection dir);
bool legacy_ui_node_get_visibility(const Node& node); bool legacy_ui_node_get_visibility(const Node& node);
void legacy_ui_node_set_visibility(Node& node, bool visible); void legacy_ui_node_set_visibility(Node& node, bool visible);
glm::vec2 legacy_ui_node_get_position(const Node& node); void legacy_ui_node_toggle_visibility(Node& node);
float legacy_ui_node_get_width(const Node& node);
float legacy_ui_node_get_height(const Node& node);
YGDirection legacy_ui_node_get_rtl(const Node& node);
} // namespace pp::panopainter } // namespace pp::panopainter

View File

@@ -1,225 +1,8 @@
#include "pch.h" #include "pch.h"
#include "legacy_ui_node_attributes.h" #include "legacy_ui_node_attributes.h"
#include "legacy_ui_node_event.h"
#include "legacy_ui_node_loader.h" #include "legacy_ui_node_loader.h"
#include "legacy_ui_node_style.h"
#include "node.h" #include "node.h"
kEventResult Node::on_event(Event* e)
{
return pp::panopainter::handle_legacy_ui_node_event(*this, e);
}
kEventResult Node::handle_event(Event* e)
{
return kEventResult::Available;
}
void Node::handle_resize(glm::vec2 old_size, glm::vec2 new_size, float zoom)
{
}
void Node::handle_parent_resize(glm::vec2 old_size, glm::vec2 new_size)
{
}
void Node::mouse_capture()
{
pp::panopainter::legacy_ui_node_mouse_capture(*this);
}
void Node::mouse_release()
{
pp::panopainter::legacy_ui_node_mouse_release(*this);
}
void Node::key_capture()
{
pp::panopainter::legacy_ui_node_key_capture(*this);
}
void Node::key_release()
{
pp::panopainter::legacy_ui_node_key_release(*this);
}
void Node::SetWidth(float value)
{
pp::panopainter::legacy_ui_node_set_width(*this, value);
}
void Node::SetWidthP(float value)
{
pp::panopainter::legacy_ui_node_set_width_percent(*this, value);
}
void Node::SetHeight(float value)
{
pp::panopainter::legacy_ui_node_set_height(*this, value);
}
void Node::SetHeightP(float value)
{
pp::panopainter::legacy_ui_node_set_height_percent(*this, value);
}
void Node::SetMaxWidth(float value)
{
pp::panopainter::legacy_ui_node_set_max_width(*this, value);
}
void Node::SetMaxWidthP(float value)
{
pp::panopainter::legacy_ui_node_set_max_width_percent(*this, value);
}
void Node::SetMaxHeight(float value)
{
pp::panopainter::legacy_ui_node_set_max_height(*this, value);
}
void Node::SetMaxHeightP(float value)
{
pp::panopainter::legacy_ui_node_set_max_height_percent(*this, value);
}
void Node::SetMinWidth(float value)
{
pp::panopainter::legacy_ui_node_set_min_width(*this, value);
}
void Node::SetMinWidthP(float value)
{
pp::panopainter::legacy_ui_node_set_min_width_percent(*this, value);
}
void Node::SetMinHeight(float value)
{
pp::panopainter::legacy_ui_node_set_min_height(*this, value);
}
void Node::SetMinHeightP(float value)
{
pp::panopainter::legacy_ui_node_set_min_height_percent(*this, value);
}
void Node::SetPadding(float t, float r, float b, float l)
{
pp::panopainter::legacy_ui_node_set_padding(*this, t, r, b, l);
}
glm::vec4 Node::GetPadding() const
{
return pp::panopainter::legacy_ui_node_get_padding(*this);
}
void Node::SetMargin(float t, float r, float b, float l)
{
pp::panopainter::legacy_ui_node_set_margin(*this, t, r, b, l);
}
glm::vec4 Node::GetMargin() const
{
return pp::panopainter::legacy_ui_node_get_margin(*this);
}
void Node::SetPosition(float l, float t)
{
pp::panopainter::legacy_ui_node_set_position(*this, l, t);
}
void Node::SetPosition(float l, float t, float r, float b)
{
pp::panopainter::legacy_ui_node_set_position(*this, l, t, r, b);
}
void Node::SetFlexGrow(float value)
{
pp::panopainter::legacy_ui_node_set_flex_grow(*this, value);
}
void Node::SetFlexShrink(float value)
{
pp::panopainter::legacy_ui_node_set_flex_shrink(*this, value);
}
void Node::SetFlexDir(YGFlexDirection value)
{
pp::panopainter::legacy_ui_node_set_flex_dir(*this, value);
}
void Node::SetFlexWrap(YGWrap value)
{
pp::panopainter::legacy_ui_node_set_flex_wrap(*this, value);
}
void Node::SetJustify(YGJustify value)
{
pp::panopainter::legacy_ui_node_set_justify(*this, value);
}
void Node::SetAlign(YGAlign value)
{
pp::panopainter::legacy_ui_node_set_align(*this, value);
}
void Node::SetPositioning(YGPositionType value)
{
pp::panopainter::legacy_ui_node_set_positioning(*this, value);
}
void Node::SetAspectRatio(float ar)
{
pp::panopainter::legacy_ui_node_set_aspect_ratio(*this, ar);
}
void Node::SetRTL(YGDirection dir)
{
pp::panopainter::legacy_ui_node_set_rtl(*this, dir);
}
bool Node::GetVisibility()
{
return pp::panopainter::legacy_ui_node_get_visibility(*this);
}
void Node::SetVisibility(bool visible)
{
pp::panopainter::legacy_ui_node_set_visibility(*this, visible);
}
void Node::ToggleVisibility()
{
SetVisibility(!m_display);
}
glm::vec2 Node::GetPosition()
{
return pp::panopainter::legacy_ui_node_get_position(*this);
}
float Node::GetWidth()
{
return pp::panopainter::legacy_ui_node_get_width(*this);
}
float Node::GetHeight()
{
return pp::panopainter::legacy_ui_node_get_height(*this);
}
glm::vec2 Node::GetSize()
{
return{ GetWidth(), GetHeight() };
}
YGDirection Node::GetRTL()
{
return pp::panopainter::legacy_ui_node_get_rtl(*this);
}
void Node::parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* attr) void Node::parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* attr)
{ {
pp::panopainter::parse_legacy_ui_node_attribute(*this, ka, attr); pp::panopainter::parse_legacy_ui_node_attribute(*this, ka, attr);