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
27 : canvas_p0(0, 0),
28 canvas_p1(0, 0),
29 canvas_sz(0, 0),
30 scaled_size(0, 0),
31 scrolling(0, 0) {}
32};
33
48 // Core identification
49 std::string canvas_id = "Canvas";
50 std::string context_id = "CanvasContext";
51
52 // Configuration (reference existing CanvasConfig)
54
55 // Selection (reference existing CanvasSelection)
57
58 // Geometry (calculated per-frame)
60
61 // Interaction state
62 ImVec2 mouse_pos_in_canvas = ImVec2(0, 0);
63 ImVec2 drawn_tile_pos = ImVec2(-1, -1);
64 bool is_hovered = false;
65
66 // Drawing state
67 ImVector<ImVec2> points; // Hover preview points
68 ImVector<ImVector<std::string>> labels;
71
72 CanvasState() = default;
73
74 // Convenience constructor with ID
75 explicit CanvasState(const std::string& id)
76 : canvas_id(id), context_id(id + "Context") {}
77};
78
79} // namespace gui
80} // namespace yaze
81
82#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