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>
6#include "imgui/imgui.h"
7
8namespace yaze {
9namespace gui {
10
19 ImVec2 canvas_p0; // Top-left screen position
20 ImVec2 canvas_p1; // Bottom-right screen position
21 ImVec2 canvas_sz; // Actual canvas size (unscaled)
22 ImVec2 scaled_size; // Size after applying global_scale
23 ImVec2 scrolling; // Current scroll offset
24
26 : canvas_p0(0, 0), canvas_p1(0, 0), canvas_sz(0, 0),
27 scaled_size(0, 0), scrolling(0, 0) {}
28};
29
44 // Core identification
45 std::string canvas_id = "Canvas";
46 std::string context_id = "CanvasContext";
47
48 // Configuration (reference existing CanvasConfig)
50
51 // Selection (reference existing CanvasSelection)
53
54 // Geometry (calculated per-frame)
56
57 // Interaction state
58 ImVec2 mouse_pos_in_canvas = ImVec2(0, 0);
59 ImVec2 drawn_tile_pos = ImVec2(-1, -1);
60 bool is_hovered = false;
61
62 // Drawing state
63 ImVector<ImVec2> points; // Hover preview points
64 ImVector<ImVector<std::string>> labels;
67
68 CanvasState() = default;
69
70 // Convenience constructor with ID
71 explicit CanvasState(const std::string& id)
72 : canvas_id(id), context_id(id + "Context") {}
73};
74
75} // namespace gui
76} // namespace yaze
77
78#endif // YAZE_APP_GUI_CANVAS_CANVAS_STATE_H
79
Main namespace for the application.
Definition controller.cc:20
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