Extract node lifecycle, preview runtime, and Win32 input state
This commit is contained in:
@@ -53,6 +53,8 @@ set(PP_LEGACY_UI_CORE_SOURCES
|
|||||||
src/legacy_ui_node_loader.h
|
src/legacy_ui_node_loader.h
|
||||||
src/legacy_ui_node_event.cpp
|
src/legacy_ui_node_event.cpp
|
||||||
src/legacy_ui_node_event.h
|
src/legacy_ui_node_event.h
|
||||||
|
src/legacy_ui_node_lifecycle.cpp
|
||||||
|
src/legacy_ui_node_lifecycle.h
|
||||||
src/legacy_ui_node_style.cpp
|
src/legacy_ui_node_style.cpp
|
||||||
src/legacy_ui_node_style.h
|
src/legacy_ui_node_style.h
|
||||||
src/legacy_ui_node_execution.cpp
|
src/legacy_ui_node_execution.cpp
|
||||||
@@ -206,6 +208,7 @@ set(PP_PANOPAINTER_UI_SOURCES
|
|||||||
src/legacy_node_stroke_preview_draw_services.cpp
|
src/legacy_node_stroke_preview_draw_services.cpp
|
||||||
src/legacy_node_stroke_preview_draw_services.h
|
src/legacy_node_stroke_preview_draw_services.h
|
||||||
src/legacy_node_stroke_preview_runtime_services.cpp
|
src/legacy_node_stroke_preview_runtime_services.cpp
|
||||||
|
src/legacy_node_stroke_preview_runtime_services.h
|
||||||
src/node_stroke_preview.cpp
|
src/node_stroke_preview.cpp
|
||||||
src/node_tool_bucket.cpp
|
src/node_tool_bucket.cpp
|
||||||
src/node_usermanual.cpp
|
src/node_usermanual.cpp
|
||||||
|
|||||||
@@ -82,10 +82,10 @@ Current hotspot files:
|
|||||||
- `src/canvas.cpp`: 429 lines
|
- `src/canvas.cpp`: 429 lines
|
||||||
- `src/app_layout.cpp`: 125 lines
|
- `src/app_layout.cpp`: 125 lines
|
||||||
- `src/canvas_modes.cpp`: 402 lines
|
- `src/canvas_modes.cpp`: 402 lines
|
||||||
- `src/node.cpp`: 389 lines
|
- `src/node.cpp`: 260 lines
|
||||||
- `src/main.cpp`: 166 lines
|
- `src/main.cpp`: 141 lines
|
||||||
- `src/node_panel_brush.cpp`: 337 lines
|
- `src/node_panel_brush.cpp`: 337 lines
|
||||||
- `src/node_stroke_preview.cpp`: 562 lines
|
- `src/node_stroke_preview.cpp`: 545 lines
|
||||||
- `src/node_canvas.cpp`: 219 lines
|
- `src/node_canvas.cpp`: 219 lines
|
||||||
- `src/app.cpp`: 171 lines
|
- `src/app.cpp`: 171 lines
|
||||||
- `src/app_dialogs.cpp`: 168 lines
|
- `src/app_dialogs.cpp`: 168 lines
|
||||||
@@ -216,7 +216,10 @@ Current architecture mismatches that must be treated as real blockers:
|
|||||||
`src/platform_windows/windows_bootstrap_helpers.cpp` instead of
|
`src/platform_windows/windows_bootstrap_helpers.cpp` instead of
|
||||||
`src/main.cpp`, while the Win32 window procedure and retained message-handling
|
`src/main.cpp`, while the Win32 window procedure and retained message-handling
|
||||||
shell now also live in `src/platform_windows/windows_window_shell.*`
|
shell now also live in `src/platform_windows/windows_window_shell.*`
|
||||||
instead of `src/main.cpp`, while the remaining interactive Win32 runtime
|
instead of `src/main.cpp`, while retained input-state zeroing and reverse
|
||||||
|
key-map initialization now also live in
|
||||||
|
`src/platform_windows/windows_window_shell.*` instead of `src/main.cpp`,
|
||||||
|
while the remaining interactive Win32 runtime
|
||||||
pocket for touch registration, render/UI thread startup, GL debug callback
|
pocket for touch registration, render/UI thread startup, GL debug callback
|
||||||
hookup, Wintab initialization/skip, icon setup, placement restore, optional
|
hookup, Wintab initialization/skip, icon setup, placement restore, optional
|
||||||
VR start, splash dismissal, message loop, and shutdown cleanup now also
|
VR start, splash dismissal, message loop, and shutdown cleanup now also
|
||||||
@@ -248,7 +251,11 @@ Current architecture mismatches that must be treated as real blockers:
|
|||||||
the remaining immediate preview pass shell now also routes through
|
the remaining immediate preview pass shell now also routes through
|
||||||
`execute_legacy_node_stroke_preview_draw_immediate_shell(...)`, which
|
`execute_legacy_node_stroke_preview_draw_immediate_shell(...)`, which
|
||||||
materially reduces the live preview-pass body even though broader
|
materially reduces the live preview-pass body even though broader
|
||||||
worker/readback flow still remains inline, while
|
worker/readback flow still remains inline, while the immediate preview
|
||||||
|
runtime/orchestration block for stroke setup, prepared-stroke construction,
|
||||||
|
pass planning, shader setup, and live render request assembly now also
|
||||||
|
routes through `src/legacy_node_stroke_preview_runtime_services.*` instead
|
||||||
|
of staying inline in `src/node_stroke_preview.cpp`, while
|
||||||
`NodeCanvas::draw()` unmerged-pass blend-gate, layer-orientation, and
|
`NodeCanvas::draw()` unmerged-pass blend-gate, layer-orientation, and
|
||||||
callback-assembly setup now also route through
|
callback-assembly setup now also route through
|
||||||
`execute_node_canvas_draw_unmerged_pass(...)`, which trims another coherent
|
`execute_node_canvas_draw_unmerged_pass(...)`, which trims another coherent
|
||||||
@@ -333,7 +340,11 @@ Current architecture mismatches that must be treated as real blockers:
|
|||||||
`clear_context`, `update`, `update_internal`, and `tick` now also lives in
|
`clear_context`, `update`, `update_internal`, and `tick` now also lives in
|
||||||
`src/legacy_ui_node_execution.cpp`, while `Node::parse_attributes(...)` now
|
`src/legacy_ui_node_execution.cpp`, while `Node::parse_attributes(...)` now
|
||||||
also routes through `src/legacy_ui_node_attributes.*` instead of staying
|
also routes through `src/legacy_ui_node_attributes.*` instead of staying
|
||||||
inline in `src/node.cpp`,
|
inline in `src/node.cpp`, while the remaining generic `Node` lifecycle/state
|
||||||
|
pocket for no-op lifecycle hooks, add/remove propagation, move construction,
|
||||||
|
destruction cleanup, and base clone plumbing now also routes through
|
||||||
|
`src/legacy_ui_node_lifecycle.*` instead of staying inline in
|
||||||
|
`src/node.cpp`,
|
||||||
while `Canvas` point-trace/unproject/project/camera push-pop-get-set and
|
while `Canvas` point-trace/unproject/project/camera push-pop-get-set and
|
||||||
face-to-shape helpers now also route through
|
face-to-shape helpers now also route through
|
||||||
`src/legacy_canvas_projection_services.*` instead of staying inline in
|
`src/legacy_canvas_projection_services.*` instead of staying inline in
|
||||||
|
|||||||
@@ -335,6 +335,13 @@ Current slice:
|
|||||||
`src/legacy_node_stroke_preview_draw_services.*` instead of staying inline in
|
`src/legacy_node_stroke_preview_draw_services.*` instead of staying inline in
|
||||||
`src/node_stroke_preview.cpp`, which trims another coherent preview
|
`src/node_stroke_preview.cpp`, which trims another coherent preview
|
||||||
draw-pass pocket while preserving the current runtime-facing shell.
|
draw-pass pocket while preserving the current runtime-facing shell.
|
||||||
|
- The immediate preview runtime/orchestration block in
|
||||||
|
`NodeStrokePreview::draw_stroke_immediate()` for stroke setup, prepared
|
||||||
|
stroke construction, pass planning, shader setup, and live render request
|
||||||
|
assembly now also lives in
|
||||||
|
`src/legacy_node_stroke_preview_runtime_services.*` instead of staying
|
||||||
|
inline in `src/node_stroke_preview.cpp`, which trims another coherent
|
||||||
|
preview runtime pocket while preserving the current live draw path.
|
||||||
- `NodeCanvas::init()` plus the remaining `NodeCanvas::draw()` outer shell now
|
- `NodeCanvas::init()` plus the remaining `NodeCanvas::draw()` outer shell now
|
||||||
also live in `src/legacy_node_canvas_draw_services.*` instead of staying
|
also live in `src/legacy_node_canvas_draw_services.*` instead of staying
|
||||||
inline in `src/node_canvas.cpp`, which materially reduces the live node to a
|
inline in `src/node_canvas.cpp`, which materially reduces the live node to a
|
||||||
@@ -644,6 +651,9 @@ Current slice:
|
|||||||
in `src/platform_windows/windows_window_shell.*` instead of `src/main.cpp`,
|
in `src/platform_windows/windows_window_shell.*` instead of `src/main.cpp`,
|
||||||
which materially thins the entry file even though broader runtime/entrypoint
|
which materially thins the entry file even though broader runtime/entrypoint
|
||||||
composition is still open
|
composition is still open
|
||||||
|
- retained input-state zeroing and reverse key-map initialization now also live
|
||||||
|
in `src/platform_windows/windows_window_shell.*` instead of `src/main.cpp`,
|
||||||
|
which trims another small but real retained-state pocket from the entry TU
|
||||||
- the remaining interactive Win32 runtime pocket for touch registration,
|
- the remaining interactive Win32 runtime pocket for touch registration,
|
||||||
render/UI thread startup, debug GL callback hookup, Wintab init/skip, icon
|
render/UI thread startup, debug GL callback hookup, Wintab init/skip, icon
|
||||||
setup, placement restore, optional VR start, splash dismissal, message
|
setup, placement restore, optional VR start, splash dismissal, message
|
||||||
@@ -802,6 +812,11 @@ Current slice:
|
|||||||
`Node::GetRTL()` now also lives in `src/legacy_ui_node_style.*` instead of
|
`Node::GetRTL()` now also lives in `src/legacy_ui_node_style.*` instead of
|
||||||
staying inline in `src/node.cpp`, which trims another coherent generic node
|
staying inline in `src/node.cpp`, which trims another coherent generic node
|
||||||
shell pocket without changing the public surface.
|
shell pocket without changing the public surface.
|
||||||
|
- The remaining generic `Node` lifecycle/state pocket for no-op lifecycle
|
||||||
|
hooks, add/remove propagation, move construction, destruction cleanup, and
|
||||||
|
base clone plumbing now also lives in `src/legacy_ui_node_lifecycle.*`
|
||||||
|
instead of staying inline in `src/node.cpp`, which materially thins another
|
||||||
|
coherent generic scene-graph shell without changing the public surface.
|
||||||
|
|
||||||
Write scope:
|
Write scope:
|
||||||
- `src/node.cpp`
|
- `src/node.cpp`
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
#include "legacy_node_stroke_preview_runtime_services.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "node_stroke_preview.h"
|
#include "node_stroke_preview.h"
|
||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
@@ -21,6 +22,86 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <stop_token>
|
#include <stop_token>
|
||||||
|
|
||||||
|
namespace pp::panopainter {
|
||||||
|
|
||||||
|
bool execute_legacy_node_stroke_preview_immediate_runtime(
|
||||||
|
const LegacyNodeStrokePreviewImmediateRuntimeRequest& request)
|
||||||
|
{
|
||||||
|
if (!request.brush ||
|
||||||
|
!request.prepare_render_target ||
|
||||||
|
!request.finish_render_target ||
|
||||||
|
!request.set_blend_enabled ||
|
||||||
|
!request.setup_stroke_shader) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const glm::vec2 render_target_size = {
|
||||||
|
static_cast<float>(request.preview_rtt.getWidth()),
|
||||||
|
static_cast<float>(request.preview_rtt.getHeight()),
|
||||||
|
};
|
||||||
|
const auto stroke_setup = plan_legacy_node_stroke_preview_stroke_setup(
|
||||||
|
LegacyNodeStrokePreviewStrokeSetupRequest {
|
||||||
|
.preview_size = request.preview_size,
|
||||||
|
.zoom = request.zoom,
|
||||||
|
.brush_tip_size = request.brush->m_tip_size,
|
||||||
|
.stroke_max_size_override = request.stroke_max_size_override,
|
||||||
|
.pad_override = request.pad_override,
|
||||||
|
.tip_size_pressure = request.brush->m_tip_size_pressure,
|
||||||
|
.dual_enabled = request.brush->m_dual_enabled,
|
||||||
|
.dual_size = request.brush->m_dual_size,
|
||||||
|
.pattern_scale = request.brush->m_pattern_scale,
|
||||||
|
.pattern_flipx = request.brush->m_pattern_flipx,
|
||||||
|
.pattern_flipy = request.brush->m_pattern_flipy,
|
||||||
|
});
|
||||||
|
const auto prepared_strokes = prepare_legacy_node_stroke_preview_strokes(
|
||||||
|
request.brush,
|
||||||
|
stroke_setup,
|
||||||
|
request.camera_fov,
|
||||||
|
request.camera_rot);
|
||||||
|
const glm::mat4 ortho_proj = glm::ortho<float>(0, render_target_size.x, 0, render_target_size.y, -1, 1);
|
||||||
|
|
||||||
|
request.prepare_render_target();
|
||||||
|
request.set_blend_enabled(false);
|
||||||
|
|
||||||
|
const auto pass_orchestration = plan_legacy_node_stroke_preview_pass_orchestration(
|
||||||
|
make_legacy_node_stroke_preview_pass_orchestration_request(
|
||||||
|
request.render_device_features,
|
||||||
|
render_target_size,
|
||||||
|
*request.brush,
|
||||||
|
ortho_proj));
|
||||||
|
request.setup_stroke_shader(pass_orchestration.stroke_shader);
|
||||||
|
const bool sequence_ok = execute_legacy_node_stroke_preview_live_render_passes(
|
||||||
|
LegacyNodeStrokePreviewLiveRenderRequest {
|
||||||
|
.brush = *request.brush,
|
||||||
|
.pass_orchestration = pass_orchestration,
|
||||||
|
.prepared_strokes = prepared_strokes,
|
||||||
|
.stroke_texture = request.preview_stroke_texture,
|
||||||
|
.mixer_rtt = request.preview_rtt_mixer,
|
||||||
|
.render_target = request.preview_rtt,
|
||||||
|
.background_texture = request.preview_background_texture,
|
||||||
|
.dual_texture = request.preview_dual_texture,
|
||||||
|
.preview_texture = request.preview_image_texture,
|
||||||
|
.linear_sampler = request.linear_sampler,
|
||||||
|
.repeat_sampler = request.repeat_sampler,
|
||||||
|
.zoom = request.zoom,
|
||||||
|
.min_flow = request.min_flow,
|
||||||
|
.copy_stroke_destination = pass_orchestration.copy_stroke_destination,
|
||||||
|
.size = render_target_size,
|
||||||
|
.bind_dual_pass_textures = request.bind_dual_pass_textures,
|
||||||
|
.capture_background = request.capture_background,
|
||||||
|
.compute_frames = request.compute_frames,
|
||||||
|
.draw_samples = request.draw_samples,
|
||||||
|
.draw_mix = request.draw_mix,
|
||||||
|
.unbind_mixer_texture = request.unbind_mixer_texture,
|
||||||
|
.bind_pattern_texture = request.bind_pattern_texture,
|
||||||
|
.draw_composite = request.draw_composite,
|
||||||
|
});
|
||||||
|
request.finish_render_target();
|
||||||
|
return sequence_ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace pp::panopainter
|
||||||
|
|
||||||
std::atomic_int NodeStrokePreview::s_instances{ 0 };
|
std::atomic_int NodeStrokePreview::s_instances{ 0 };
|
||||||
std::atomic_bool NodeStrokePreview::s_running{ false };
|
std::atomic_bool NodeStrokePreview::s_running{ false };
|
||||||
std::mutex NodeStrokePreview::s_render_mutex;
|
std::mutex NodeStrokePreview::s_render_mutex;
|
||||||
|
|||||||
53
src/legacy_node_stroke_preview_runtime_services.h
Normal file
53
src/legacy_node_stroke_preview_runtime_services.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../libs/glm/glm/ext/matrix_float4x4.hpp"
|
||||||
|
#include "../libs/glm/glm/ext/vector_float2.hpp"
|
||||||
|
|
||||||
|
#include "brush.h"
|
||||||
|
#include "legacy_node_stroke_preview_draw_services.h"
|
||||||
|
#include "renderer_api/renderer_api.h"
|
||||||
|
#include "rtt.h"
|
||||||
|
#include "texture.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace pp::panopainter {
|
||||||
|
|
||||||
|
struct LegacyNodeStrokePreviewImmediateRuntimeRequest {
|
||||||
|
const std::shared_ptr<Brush>& brush;
|
||||||
|
glm::vec2 preview_size {};
|
||||||
|
float zoom = 1.0f;
|
||||||
|
float min_flow = 0.0f;
|
||||||
|
float stroke_max_size_override = 0.0f;
|
||||||
|
float pad_override = NAN;
|
||||||
|
float camera_fov = 0.0f;
|
||||||
|
glm::mat4 camera_rot { 1.0f };
|
||||||
|
pp::renderer::RenderDeviceFeatures render_device_features {};
|
||||||
|
RTT& preview_rtt;
|
||||||
|
RTT& preview_rtt_mixer;
|
||||||
|
Texture2D& preview_stroke_texture;
|
||||||
|
Texture2D& preview_dual_texture;
|
||||||
|
Texture2D& preview_background_texture;
|
||||||
|
Texture2D& preview_image_texture;
|
||||||
|
Sampler& linear_sampler;
|
||||||
|
Sampler& repeat_sampler;
|
||||||
|
std::function<void()> prepare_render_target;
|
||||||
|
std::function<void()> finish_render_target;
|
||||||
|
std::function<void(bool)> set_blend_enabled;
|
||||||
|
std::function<void(const LegacyStrokeShaderSetupUniforms&)> setup_stroke_shader;
|
||||||
|
std::function<void(const Brush&)> bind_dual_pass_textures;
|
||||||
|
std::function<void(bool)> capture_background;
|
||||||
|
std::function<std::vector<LegacyNodeStrokePreviewFrame>(const Stroke&, float)> compute_frames;
|
||||||
|
std::function<glm::vec4(std::array<vertex_t, 4>&, Texture2D&, bool)> draw_samples;
|
||||||
|
std::function<void(const glm::vec2&, const glm::vec2&)> draw_mix;
|
||||||
|
std::function<void()> unbind_mixer_texture;
|
||||||
|
std::function<void()> bind_pattern_texture;
|
||||||
|
std::function<void()> draw_composite;
|
||||||
|
};
|
||||||
|
|
||||||
|
[[nodiscard]] bool execute_legacy_node_stroke_preview_immediate_runtime(
|
||||||
|
const LegacyNodeStrokePreviewImmediateRuntimeRequest& request);
|
||||||
|
|
||||||
|
} // namespace pp::panopainter
|
||||||
178
src/legacy_ui_node_lifecycle.cpp
Normal file
178
src/legacy_ui_node_lifecycle.cpp
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "legacy_ui_node_lifecycle.h"
|
||||||
|
|
||||||
|
#include "node.h"
|
||||||
|
|
||||||
|
namespace pp::panopainter
|
||||||
|
{
|
||||||
|
void legacy_ui_node_move_construct(Node& dest, Node&& src)
|
||||||
|
{
|
||||||
|
dest.m_name = std::move(src.m_name);
|
||||||
|
dest.m_nodeID_s = std::move(src.m_nodeID_s);
|
||||||
|
dest.m_children = std::move(src.m_children);
|
||||||
|
dest.m_nodeID = src.m_nodeID;
|
||||||
|
dest.m_display = src.m_display;
|
||||||
|
dest.m_parent = src.m_parent;
|
||||||
|
dest.y_node = src.y_node;
|
||||||
|
dest.m_pos = src.m_pos;
|
||||||
|
dest.m_size = src.m_size;
|
||||||
|
dest.m_clip = src.m_clip;
|
||||||
|
dest.m_zoom = src.m_zoom;
|
||||||
|
dest.m_mouse_ignore = src.m_mouse_ignore;
|
||||||
|
src.y_node = nullptr;
|
||||||
|
src.m_parent = nullptr;
|
||||||
|
|
||||||
|
dest.set_manager(src.m_manager);
|
||||||
|
for (auto& child : dest.m_children)
|
||||||
|
child->m_parent = &dest;
|
||||||
|
|
||||||
|
dest.current_mouse_capture = src.current_mouse_capture;
|
||||||
|
dest.current_key_capture = src.current_key_capture;
|
||||||
|
dest.m_mouse_captured = src.m_mouse_captured;
|
||||||
|
dest.m_key_captured = src.m_key_captured;
|
||||||
|
|
||||||
|
dest.m_proj = src.m_proj;
|
||||||
|
dest.m_mvp = src.m_mvp;
|
||||||
|
dest.m_mouse_inside = src.m_mouse_inside;
|
||||||
|
dest.m_flood_events = src.m_flood_events;
|
||||||
|
dest.m_force_mouse_capture = src.m_force_mouse_capture;
|
||||||
|
dest.m_capture_children = src.m_capture_children;
|
||||||
|
dest.m_destroyed = false; // src.m_destroyed
|
||||||
|
|
||||||
|
dest.m_scale = src.m_scale;
|
||||||
|
dest.m_pos_origin = src.m_pos_origin;
|
||||||
|
dest.m_pos_offset = src.m_pos_offset;
|
||||||
|
dest.m_pos_offset_childred = src.m_pos_offset_childred;
|
||||||
|
dest.m_clip_uncut = src.m_clip_uncut;
|
||||||
|
|
||||||
|
dest.auto_width = src.auto_width;
|
||||||
|
dest.auto_height = src.auto_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
void legacy_ui_node_destroy(Node& node)
|
||||||
|
{
|
||||||
|
node.m_children.clear();
|
||||||
|
if (node.y_node)
|
||||||
|
YGNodeFree(node.y_node);
|
||||||
|
if (node.y_placeholder)
|
||||||
|
YGNodeFree(node.y_placeholder);
|
||||||
|
}
|
||||||
|
|
||||||
|
void legacy_ui_node_clone_copy(const Node& src, Node& dest)
|
||||||
|
{
|
||||||
|
YGNodeCopyStyle(dest.y_node, src.y_node);
|
||||||
|
dest.set_manager(src.m_manager);
|
||||||
|
|
||||||
|
dest.m_name = src.m_name;
|
||||||
|
dest.m_nodeID_s = src.m_nodeID_s;
|
||||||
|
dest.m_nodeID = src.m_nodeID;
|
||||||
|
dest.m_display = src.m_display;
|
||||||
|
dest.m_pos = src.m_pos;
|
||||||
|
dest.m_size = src.m_size;
|
||||||
|
dest.m_clip = src.m_clip;
|
||||||
|
dest.m_flood_events = src.m_flood_events;
|
||||||
|
dest.m_force_mouse_capture = src.m_force_mouse_capture;
|
||||||
|
|
||||||
|
dest.current_mouse_capture = src.current_mouse_capture;
|
||||||
|
dest.current_key_capture = src.current_key_capture;
|
||||||
|
dest.m_mouse_captured = src.m_mouse_captured;
|
||||||
|
dest.m_key_captured = src.m_key_captured;
|
||||||
|
dest.m_proj = src.m_proj;
|
||||||
|
dest.m_mvp = src.m_mvp;
|
||||||
|
dest.m_mouse_inside = src.m_mouse_inside;
|
||||||
|
dest.m_capture_children = src.m_capture_children;
|
||||||
|
dest.m_destroyed = false; // src.m_destroyed
|
||||||
|
dest.m_scale = src.m_scale;
|
||||||
|
dest.m_pos_origin = src.m_pos_origin;
|
||||||
|
dest.m_pos_offset = src.m_pos_offset;
|
||||||
|
dest.m_pos_offset_childred = src.m_pos_offset_childred;
|
||||||
|
dest.m_clip_uncut = src.m_clip_uncut;
|
||||||
|
|
||||||
|
dest.auto_width = src.auto_width;
|
||||||
|
dest.auto_height = src.auto_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
void legacy_ui_node_clone_children(const Node& src, Node& dest)
|
||||||
|
{
|
||||||
|
for (auto& child : src.m_children)
|
||||||
|
{
|
||||||
|
std::shared_ptr<Node> clone = child->clone();
|
||||||
|
dest.m_children.push_back(clone);
|
||||||
|
clone->m_parent = &dest;
|
||||||
|
clone->set_manager(dest.m_manager);
|
||||||
|
clone->loaded();
|
||||||
|
YGNodeInsertChild(dest.y_node, clone->y_node, YGNodeGetChildCount(dest.y_node));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Node::create()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Node::init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Node::loaded()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Node::added(Node* parent)
|
||||||
|
{
|
||||||
|
for (auto& child : m_children)
|
||||||
|
child->added(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Node::removed(Node* parent)
|
||||||
|
{
|
||||||
|
for (auto current = m_parent; current; current = current->m_parent)
|
||||||
|
if (current->child_mouse_focus.get() == this)
|
||||||
|
current->child_mouse_focus = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Node&& Node::operator=(Node&& o)
|
||||||
|
{
|
||||||
|
return std::forward<Node>(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
Node::Node()
|
||||||
|
{
|
||||||
|
y_node = YGNodeNew();
|
||||||
|
YGNodeSetContext(y_node, this);
|
||||||
|
y_placeholder = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Node::Node(Node&& o)
|
||||||
|
{
|
||||||
|
pp::panopainter::legacy_ui_node_move_construct(*this, std::move(o));
|
||||||
|
}
|
||||||
|
|
||||||
|
Node::~Node()
|
||||||
|
{
|
||||||
|
pp::panopainter::legacy_ui_node_destroy(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Node::draw()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Node* Node::clone_instantiate() const
|
||||||
|
{
|
||||||
|
return new Node();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Node::clone_copy(Node* dest) const
|
||||||
|
{
|
||||||
|
pp::panopainter::legacy_ui_node_clone_copy(*this, *dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Node::clone_children(Node* dest) const
|
||||||
|
{
|
||||||
|
pp::panopainter::legacy_ui_node_clone_children(*this, *dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Node::clone_finalize(Node* dest) const
|
||||||
|
{
|
||||||
|
/* find controllers and stuff */
|
||||||
|
}
|
||||||
11
src/legacy_ui_node_lifecycle.h
Normal file
11
src/legacy_ui_node_lifecycle.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
class Node;
|
||||||
|
|
||||||
|
namespace pp::panopainter
|
||||||
|
{
|
||||||
|
void legacy_ui_node_move_construct(Node& dest, Node&& src);
|
||||||
|
void legacy_ui_node_destroy(Node& node);
|
||||||
|
void legacy_ui_node_clone_copy(const Node& src, Node& dest);
|
||||||
|
void legacy_ui_node_clone_children(const Node& src, Node& dest);
|
||||||
|
}
|
||||||
28
src/main.cpp
28
src/main.cpp
@@ -6,7 +6,6 @@
|
|||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "canvas.h"
|
#include "canvas.h"
|
||||||
#include "keymap.h"
|
|
||||||
#include "platform_windows/windows_bootstrap_helpers.h"
|
#include "platform_windows/windows_bootstrap_helpers.h"
|
||||||
#include "platform_windows/windows_platform_services.h"
|
#include "platform_windows/windows_platform_services.h"
|
||||||
#include "platform_windows/windows_lifecycle_shell.h"
|
#include "platform_windows/windows_lifecycle_shell.h"
|
||||||
@@ -75,30 +74,6 @@ void win32_update_fps(int frames)
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a reverse map from kKey to VK_XXX
|
|
||||||
void init_vk_map()
|
|
||||||
{
|
|
||||||
auto& state = retained_state();
|
|
||||||
for (int k = 1; k < 256; k++) // ignore kKey::Unknown = 0
|
|
||||||
{
|
|
||||||
for (int vk = 0; vk < 256; vk++)
|
|
||||||
{
|
|
||||||
if (k == (int)convert_key(vk))
|
|
||||||
{
|
|
||||||
if (state.vkey_map.find((kKey)k) == state.vkey_map.end())
|
|
||||||
{
|
|
||||||
state.vkey_map.insert({ (kKey)k, vk });
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG("KEY MAP COLLISION %d and %d maps to %d",
|
|
||||||
(int)vk, (int)state.vkey_map[(kKey)k], (int)k);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool win32_vr_start()
|
bool win32_vr_start()
|
||||||
{
|
{
|
||||||
auto& state = retained_state();
|
auto& state = retained_state();
|
||||||
@@ -133,7 +108,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
pp::platform::windows::SplashScreen splash(GetModuleHandle(NULL));
|
pp::platform::windows::SplashScreen splash(GetModuleHandle(NULL));
|
||||||
|
|
||||||
init_vk_map();
|
pp::platform::windows::initialize_retained_input_state();
|
||||||
|
|
||||||
pp::platform::windows::setup_exception_handler();
|
pp::platform::windows::setup_exception_handler();
|
||||||
|
|
||||||
@@ -141,7 +116,6 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
App::I->create();
|
App::I->create();
|
||||||
|
|
||||||
memset(&state.keys, 0, sizeof(state.keys));
|
|
||||||
auto startup = pp::platform::windows::initialize_main_window_startup_state();
|
auto startup = pp::platform::windows::initialize_main_window_startup_state();
|
||||||
auto context = pp::platform::windows::OpenGlWindowContext {};
|
auto context = pp::platform::windows::OpenGlWindowContext {};
|
||||||
switch (pp::platform::windows::initialize_main_window_and_gl(startup, state.hWnd, state.hInst, state.window_title, context))
|
switch (pp::platform::windows::initialize_main_window_and_gl(startup, state.hWnd, state.hInst, state.window_title, context))
|
||||||
|
|||||||
155
src/node.cpp
155
src/node.cpp
@@ -49,34 +49,6 @@ void Node::handle_parent_resize(glm::vec2 old_size, glm::vec2 new_size)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::create()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Node::init()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Node::loaded()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Node::added(Node* parent)
|
|
||||||
{
|
|
||||||
for (auto& c : m_children)
|
|
||||||
c->added(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Node::removed(Node* parent)
|
|
||||||
{
|
|
||||||
for (auto p = m_parent; p; p = p->m_parent)
|
|
||||||
if (p->child_mouse_focus.get() == this)
|
|
||||||
p->child_mouse_focus = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Node::mouse_capture()
|
void Node::mouse_capture()
|
||||||
{
|
{
|
||||||
pp::panopainter::legacy_ui_node_mouse_capture(*this);
|
pp::panopainter::legacy_ui_node_mouse_capture(*this);
|
||||||
@@ -97,71 +69,6 @@ void Node::key_release()
|
|||||||
pp::panopainter::legacy_ui_node_key_release(*this);
|
pp::panopainter::legacy_ui_node_key_release(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Node&& Node::operator=(Node&& o)
|
|
||||||
{
|
|
||||||
return std::forward<Node>(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
Node::Node()
|
|
||||||
{
|
|
||||||
y_node = YGNodeNew();
|
|
||||||
YGNodeSetContext(y_node, this);
|
|
||||||
y_placeholder = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
Node::Node(Node&& o)
|
|
||||||
{
|
|
||||||
m_name = std::move(o.m_name);
|
|
||||||
m_nodeID_s = std::move(o.m_nodeID_s);
|
|
||||||
m_children = std::move(o.m_children);
|
|
||||||
m_nodeID = o.m_nodeID;
|
|
||||||
m_display = o.m_display;
|
|
||||||
m_parent = o.m_parent;
|
|
||||||
y_node = o.y_node;
|
|
||||||
m_pos = o.m_pos;
|
|
||||||
m_size = o.m_size;
|
|
||||||
m_clip = o.m_clip;
|
|
||||||
m_zoom = o.m_zoom;
|
|
||||||
m_mouse_ignore = o.m_mouse_ignore;
|
|
||||||
o.y_node = nullptr;
|
|
||||||
o.m_parent = nullptr;
|
|
||||||
|
|
||||||
set_manager(o.m_manager);
|
|
||||||
for (auto& c : m_children)
|
|
||||||
c->m_parent = this;
|
|
||||||
|
|
||||||
current_mouse_capture = o.current_mouse_capture;
|
|
||||||
current_key_capture = o.current_key_capture;
|
|
||||||
m_mouse_captured = o.m_mouse_captured;
|
|
||||||
m_key_captured = o.m_key_captured;
|
|
||||||
|
|
||||||
m_proj = o.m_proj;
|
|
||||||
m_mvp = o.m_mvp;
|
|
||||||
m_mouse_inside = o.m_mouse_inside;
|
|
||||||
m_flood_events = o.m_flood_events;
|
|
||||||
m_force_mouse_capture = o.m_force_mouse_capture;
|
|
||||||
m_capture_children = o.m_capture_children;
|
|
||||||
m_destroyed = false;// o.m_destroyed;
|
|
||||||
|
|
||||||
m_scale = o.m_scale;
|
|
||||||
m_pos_origin = o.m_pos_origin;
|
|
||||||
m_pos_offset = o.m_pos_offset;
|
|
||||||
m_pos_offset_childred = o.m_pos_offset_childred;
|
|
||||||
m_clip_uncut = o.m_clip_uncut;
|
|
||||||
|
|
||||||
auto_width = o.auto_width;
|
|
||||||
auto_height = o.auto_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
Node::~Node()
|
|
||||||
{
|
|
||||||
m_children.clear();
|
|
||||||
if (y_node)
|
|
||||||
YGNodeFree(y_node);
|
|
||||||
if (y_placeholder)
|
|
||||||
YGNodeFree(y_placeholder);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Node::SetWidth(float value)
|
void Node::SetWidth(float value)
|
||||||
{
|
{
|
||||||
pp::panopainter::legacy_ui_node_set_width(*this, value);
|
pp::panopainter::legacy_ui_node_set_width(*this, value);
|
||||||
@@ -412,65 +319,3 @@ void Node::load_internal(const tinyxml2::XMLElement* x_node, bool skip_children
|
|||||||
pp::panopainter::load_legacy_ui_children(*this, *x_node);
|
pp::panopainter::load_legacy_ui_children(*this, *x_node);
|
||||||
loaded();
|
loaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::draw()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Node* Node::clone_instantiate() const
|
|
||||||
{
|
|
||||||
return new Node();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Node::clone_copy(Node* dest) const
|
|
||||||
{
|
|
||||||
YGNodeCopyStyle(dest->y_node, y_node);
|
|
||||||
dest->set_manager(m_manager);
|
|
||||||
|
|
||||||
dest->m_name = m_name;
|
|
||||||
dest->m_nodeID_s = m_nodeID_s;
|
|
||||||
dest->m_nodeID = m_nodeID;
|
|
||||||
dest->m_display = m_display;
|
|
||||||
dest->m_pos = m_pos;
|
|
||||||
dest->m_size = m_size;
|
|
||||||
dest->m_clip = m_clip;
|
|
||||||
dest->m_flood_events = m_flood_events;
|
|
||||||
dest->m_force_mouse_capture = m_force_mouse_capture;
|
|
||||||
|
|
||||||
dest->current_mouse_capture = current_mouse_capture;
|
|
||||||
dest->current_key_capture = current_key_capture;
|
|
||||||
dest->m_mouse_captured = m_mouse_captured;
|
|
||||||
dest->m_key_captured = m_key_captured;
|
|
||||||
dest->m_proj = m_proj;
|
|
||||||
dest->m_mvp = m_mvp;
|
|
||||||
dest->m_mouse_inside = m_mouse_inside;
|
|
||||||
dest->m_capture_children = m_capture_children;
|
|
||||||
dest->m_destroyed = false;// m_destroyed;
|
|
||||||
dest->m_scale = m_scale;
|
|
||||||
dest->m_pos_origin = m_pos_origin;
|
|
||||||
dest->m_pos_offset = m_pos_offset;
|
|
||||||
dest->m_pos_offset_childred = m_pos_offset_childred;
|
|
||||||
dest->m_clip_uncut = m_clip_uncut;
|
|
||||||
|
|
||||||
dest->auto_width = auto_width;
|
|
||||||
dest->auto_height = auto_height;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Node::clone_children(Node* dest) const
|
|
||||||
{
|
|
||||||
for (auto& c : m_children)
|
|
||||||
{
|
|
||||||
std::shared_ptr<Node> cn = c->clone();
|
|
||||||
dest->m_children.push_back(cn);
|
|
||||||
cn->m_parent = dest;
|
|
||||||
cn->set_manager(dest->m_manager);
|
|
||||||
cn->loaded();
|
|
||||||
YGNodeInsertChild(dest->y_node, cn->y_node, YGNodeGetChildCount(dest->y_node));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Node::clone_finalize(Node* dest) const
|
|
||||||
{
|
|
||||||
/* find controllers and stuff */
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "legacy_canvas_stroke_shader_services.h"
|
#include "legacy_canvas_stroke_shader_services.h"
|
||||||
#include "legacy_canvas_stroke_services.h"
|
#include "legacy_canvas_stroke_services.h"
|
||||||
#include "legacy_node_stroke_preview_execution_services.h"
|
#include "legacy_node_stroke_preview_execution_services.h"
|
||||||
|
#include "legacy_node_stroke_preview_runtime_services.h"
|
||||||
#include "legacy_ui_gl_dispatch.h"
|
#include "legacy_ui_gl_dispatch.h"
|
||||||
#include "paint_renderer/compositor.h"
|
#include "paint_renderer/compositor.h"
|
||||||
#include "renderer_gl/opengl_capabilities.h"
|
#include "renderer_gl/opengl_capabilities.h"
|
||||||
@@ -506,66 +507,45 @@ void NodeStrokePreview::draw_stroke_immediate()
|
|||||||
|
|
||||||
const auto vp = query_stroke_preview_viewport();
|
const auto vp = query_stroke_preview_viewport();
|
||||||
const auto cc = query_stroke_preview_clear_color();
|
const auto cc = query_stroke_preview_clear_color();
|
||||||
|
const glm::vec2 size = { m_rtt.getWidth(), m_rtt.getHeight() };
|
||||||
float zoom = root()->m_zoom;
|
const float zoom = root()->m_zoom;
|
||||||
|
const bool sequence_ok = pp::panopainter::execute_legacy_node_stroke_preview_immediate_runtime(
|
||||||
glm::vec2 size = { m_rtt.getWidth(), m_rtt.getHeight() };
|
pp::panopainter::LegacyNodeStrokePreviewImmediateRuntimeRequest {
|
||||||
const auto stroke_setup = pp::panopainter::plan_legacy_node_stroke_preview_stroke_setup(
|
.brush = m_brush,
|
||||||
pp::panopainter::LegacyNodeStrokePreviewStrokeSetupRequest {
|
|
||||||
.preview_size = m_size,
|
.preview_size = m_size,
|
||||||
.zoom = zoom,
|
.zoom = zoom,
|
||||||
.brush_tip_size = m_brush->m_tip_size,
|
.min_flow = m_min_flow,
|
||||||
.stroke_max_size_override = m_max_size,
|
.stroke_max_size_override = m_max_size,
|
||||||
.pad_override = m_pad_override,
|
.pad_override = m_pad_override,
|
||||||
.tip_size_pressure = m_brush->m_tip_size_pressure,
|
.camera_fov = Canvas::I->m_cam_fov,
|
||||||
.dual_enabled = m_brush->m_dual_enabled,
|
.camera_rot = Canvas::I->m_cam_rot,
|
||||||
.dual_size = m_brush->m_dual_size,
|
.render_device_features = stroke_preview_render_device_features(),
|
||||||
.pattern_scale = m_brush->m_pattern_scale,
|
.preview_rtt = m_rtt,
|
||||||
.pattern_flipx = m_brush->m_pattern_flipx,
|
.preview_rtt_mixer = m_rtt_mixer,
|
||||||
.pattern_flipy = m_brush->m_pattern_flipy,
|
.preview_stroke_texture = m_tex,
|
||||||
});
|
.preview_dual_texture = m_tex_dual,
|
||||||
glm::mat4 ortho_proj = glm::ortho<float>(0, size.x, 0, size.y, -1, 1);
|
.preview_background_texture = m_tex_background,
|
||||||
apply_stroke_preview_viewport(0, 0, m_rtt.getWidth(), m_rtt.getHeight());
|
.preview_image_texture = m_tex_preview,
|
||||||
m_rtt.bindFramebuffer();
|
|
||||||
m_rtt.clear();
|
|
||||||
bind_stroke_preview_live_samplers(
|
|
||||||
m_sampler_mipmap,
|
|
||||||
m_sampler_linear,
|
|
||||||
m_sampler_linear_repeat);
|
|
||||||
|
|
||||||
const auto& b = m_brush;
|
|
||||||
|
|
||||||
auto prepared_strokes = pp::panopainter::prepare_legacy_node_stroke_preview_strokes(
|
|
||||||
b,
|
|
||||||
stroke_setup,
|
|
||||||
Canvas::I->m_cam_fov,
|
|
||||||
Canvas::I->m_cam_rot);
|
|
||||||
|
|
||||||
apply_stroke_preview_capability(pp::renderer::gl::blend_state(), false);
|
|
||||||
const auto pass_orchestration = pp::panopainter::plan_legacy_node_stroke_preview_pass_orchestration(
|
|
||||||
pp::panopainter::make_legacy_node_stroke_preview_pass_orchestration_request(
|
|
||||||
stroke_preview_render_device_features(),
|
|
||||||
size,
|
|
||||||
*b,
|
|
||||||
ortho_proj));
|
|
||||||
pp::panopainter::setup_legacy_stroke_shader(pass_orchestration.stroke_shader);
|
|
||||||
const bool sequence_ok = pp::panopainter::execute_legacy_node_stroke_preview_live_render_passes(
|
|
||||||
pp::panopainter::LegacyNodeStrokePreviewLiveRenderRequest {
|
|
||||||
.brush = *b,
|
|
||||||
.pass_orchestration = pass_orchestration,
|
|
||||||
.prepared_strokes = prepared_strokes,
|
|
||||||
.stroke_texture = m_tex,
|
|
||||||
.mixer_rtt = m_rtt_mixer,
|
|
||||||
.render_target = m_rtt,
|
|
||||||
.background_texture = m_tex_background,
|
|
||||||
.dual_texture = m_tex_dual,
|
|
||||||
.preview_texture = m_tex_preview,
|
|
||||||
.linear_sampler = m_sampler_linear,
|
.linear_sampler = m_sampler_linear,
|
||||||
.repeat_sampler = m_sampler_linear_repeat,
|
.repeat_sampler = m_sampler_linear_repeat,
|
||||||
.zoom = zoom,
|
.prepare_render_target = [&] {
|
||||||
.min_flow = m_min_flow,
|
apply_stroke_preview_viewport(0, 0, m_rtt.getWidth(), m_rtt.getHeight());
|
||||||
.copy_stroke_destination = pass_orchestration.copy_stroke_destination,
|
m_rtt.bindFramebuffer();
|
||||||
.size = size,
|
m_rtt.clear();
|
||||||
|
bind_stroke_preview_live_samplers(
|
||||||
|
m_sampler_mipmap,
|
||||||
|
m_sampler_linear,
|
||||||
|
m_sampler_linear_repeat);
|
||||||
|
},
|
||||||
|
.finish_render_target = [&] {
|
||||||
|
m_rtt.unbindFramebuffer();
|
||||||
|
},
|
||||||
|
.set_blend_enabled = [&](bool enabled) {
|
||||||
|
apply_stroke_preview_capability(pp::renderer::gl::blend_state(), enabled);
|
||||||
|
},
|
||||||
|
.setup_stroke_shader = [](const pp::panopainter::LegacyStrokeShaderSetupUniforms& uniforms) {
|
||||||
|
pp::panopainter::setup_legacy_stroke_shader(uniforms);
|
||||||
|
},
|
||||||
.bind_dual_pass_textures = [](const Brush& dual_brush) {
|
.bind_dual_pass_textures = [](const Brush& dual_brush) {
|
||||||
bind_stroke_preview_dual_pass_textures(dual_brush);
|
bind_stroke_preview_dual_pass_textures(dual_brush);
|
||||||
},
|
},
|
||||||
@@ -592,7 +572,7 @@ void NodeStrokePreview::draw_stroke_immediate()
|
|||||||
m_rtt_mixer.unbindTexture();
|
m_rtt_mixer.unbindTexture();
|
||||||
},
|
},
|
||||||
.bind_pattern_texture = [&] {
|
.bind_pattern_texture = [&] {
|
||||||
b->m_pattern_texture ? b->m_pattern_texture->bind() : unbind_texture_2d();
|
m_brush->m_pattern_texture ? m_brush->m_pattern_texture->bind() : unbind_texture_2d();
|
||||||
},
|
},
|
||||||
.draw_composite = [&] {
|
.draw_composite = [&] {
|
||||||
m_plane.draw_fill();
|
m_plane.draw_fill();
|
||||||
@@ -600,8 +580,6 @@ void NodeStrokePreview::draw_stroke_immediate()
|
|||||||
});
|
});
|
||||||
assert(sequence_ok);
|
assert(sequence_ok);
|
||||||
|
|
||||||
m_rtt.unbindFramebuffer();
|
|
||||||
|
|
||||||
apply_stroke_preview_viewport(vp.x, vp.y, vp.width, vp.height);
|
apply_stroke_preview_viewport(vp.x, vp.y, vp.width, vp.height);
|
||||||
apply_stroke_preview_clear_color(cc);
|
apply_stroke_preview_clear_color(cc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,31 @@ void destroy_window();
|
|||||||
|
|
||||||
namespace pp::platform::windows {
|
namespace pp::platform::windows {
|
||||||
|
|
||||||
|
void initialize_retained_input_state()
|
||||||
|
{
|
||||||
|
auto& state = retained_state();
|
||||||
|
memset(&state.keys, 0, sizeof(state.keys));
|
||||||
|
for (int k = 1; k < 256; ++k) // ignore kKey::Unknown = 0
|
||||||
|
{
|
||||||
|
for (int vk = 0; vk < 256; ++vk)
|
||||||
|
{
|
||||||
|
if (k != (int)convert_key(vk))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
auto key = (kKey)k;
|
||||||
|
if (state.vkey_map.find(key) == state.vkey_map.end())
|
||||||
|
{
|
||||||
|
state.vkey_map.insert({ key, vk });
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG("KEY MAP COLLISION %d and %d maps to %d",
|
||||||
|
vk, state.vkey_map[key], k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RetainedState& retained_state()
|
RetainedState& retained_state()
|
||||||
{
|
{
|
||||||
static RetainedState state;
|
static RetainedState state;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ struct RetainedState
|
|||||||
|
|
||||||
namespace pp::platform::windows {
|
namespace pp::platform::windows {
|
||||||
|
|
||||||
|
void initialize_retained_input_state();
|
||||||
RetainedState& retained_state();
|
RetainedState& retained_state();
|
||||||
LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
|
LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user