yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
canvas_helpers.h
Go to the documentation of this file.
1#ifndef YAZE_GUI_CANVAS_HELPERS_H
2#define YAZE_GUI_CANVAS_HELPERS_H
3
5
6namespace yaze::gui {
7
8// Convenience factory for common frame options.
9inline CanvasFrameOptions MakeFrameOptions(ImVec2 size = ImVec2(0, 0),
10 float grid_step = 16.0f,
11 bool draw_grid = true,
12 bool draw_overlay = true,
13 bool render_popups = true,
14 bool draw_context_menu = false) {
16 opts.canvas_size = size;
17 opts.draw_context_menu = draw_context_menu;
18 opts.draw_grid = draw_grid;
19 opts.draw_overlay = draw_overlay;
20 opts.render_popups = render_popups;
21 if (grid_step > 0.0f) {
22 opts.grid_step = grid_step;
23 }
24 return opts;
25}
26
27inline SelectorPanelOpts MakeSelectorOpts(ImVec2 size, float grid_step,
28 int tile_size,
29 bool ensure_texture = true,
30 bool render_popups = true) {
32 opts.canvas_size = size;
33 opts.grid_step = grid_step;
34 opts.tile_selector_size = tile_size;
35 opts.ensure_texture = ensure_texture;
36 opts.render_popups = render_popups;
37 return opts;
38}
39
40inline PreviewPanelOpts MakePreviewOpts(ImVec2 size, float grid_step = 0.0f,
41 bool ensure_texture = true,
42 bool render_popups = false) {
44 opts.canvas_size = size;
45 opts.grid_step = grid_step;
46 opts.ensure_texture = ensure_texture;
47 opts.render_popups = render_popups;
48 return opts;
49}
50
52 CanvasConfig& cfg) {
54 RegisterDefaultCanvasMenu(host, rt, cfg);
55 return host;
56}
57
58} // namespace yaze::gui
59
60#endif // YAZE_GUI_CANVAS_HELPERS_H
61
Graphical User Interface (GUI) components for the application.
SelectorPanelOpts MakeSelectorOpts(ImVec2 size, float grid_step, int tile_size, bool ensure_texture=true, bool render_popups=true)
CanvasMenuActionHost MakeMenuHostWithDefaults(const CanvasRuntime &rt, CanvasConfig &cfg)
CanvasFrameOptions MakeFrameOptions(ImVec2 size=ImVec2(0, 0), float grid_step=16.0f, bool draw_grid=true, bool draw_overlay=true, bool render_popups=true, bool draw_context_menu=false)
PreviewPanelOpts MakePreviewOpts(ImVec2 size, float grid_step=0.0f, bool ensure_texture=true, bool render_popups=false)
void RegisterDefaultCanvasMenu(CanvasMenuActionHost &host, const CanvasRuntime &rt, CanvasConfig &cfg)
Unified configuration for canvas display and interaction.
std::optional< float > grid_step
Definition canvas.h:70