yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
canvas_state.h
Go to the documentation of this file.
1#ifndef YAZE_APP_GUI_CANVAS_CANVAS_STATE_H
2#define YAZE_APP_GUI_CANVAS_CANVAS_STATE_H
3
4#include <string>
5
7#include "imgui/imgui.h"
8
9namespace yaze {
10namespace gui {
11
20 ImVec2 canvas_p0; // Top-left screen position
21 ImVec2 canvas_p1; // Bottom-right screen position
22 ImVec2 canvas_sz; // Actual canvas size (unscaled)
23 ImVec2 scaled_size; // Size after applying global_scale
24 ImVec2 scrolling; // Current scroll offset
25 // Visible host size in screen pixels, independent of content size and zoom.
27
29 : canvas_p0(0, 0),
30 canvas_p1(0, 0),
31 canvas_sz(0, 0),
32 scaled_size(0, 0),
33 scrolling(0, 0),
34 viewport_size(0, 0) {}
35};
36
51 // Core identification
52 std::string canvas_id = "Canvas";
53 std::string context_id = "CanvasContext";
54
55 // Configuration (reference existing CanvasConfig)
57
58 // Selection (reference existing CanvasSelection)
60
61 // Geometry (calculated per-frame)
63
64 // Interaction state
65 ImVec2 mouse_pos_in_canvas = ImVec2(0, 0);
66 ImVec2 drawn_tile_pos = ImVec2(-1, -1);
67 bool is_hovered = false;
68
69 // Drawing state
70 ImVector<ImVec2> points; // Hover preview points
71 ImVector<ImVector<std::string>> labels;
74
75 CanvasState() = default;
76
77 // Convenience constructor with ID
78 explicit CanvasState(const std::string& id)
79 : canvas_id(id), context_id(id + "Context") {}
80};
81
82} // namespace gui
83} // namespace yaze
84
85#endif // YAZE_APP_GUI_CANVAS_CANVAS_STATE_H
Unified configuration for canvas display and interaction.
Canvas geometry calculated per-frame.
Selection state for canvas interactions.
Complete canvas state snapshot.
CanvasState(const std::string &id)
ImVector< ImVector< std::string > > labels
CanvasSelection selection
CanvasGeometry geometry
ImVector< ImVec2 > points