FuncDoodle
Loading...
Searching...
No Matches
Grid.h
Go to the documentation of this file.
1
19
20#pragma once
21
22#include "UI/Gui.h"
23
24#include "Project/Frame.h"
25
26namespace FuncDoodle {
33 class Grid {
34 public:
37 Grid(int gridWidth, int gridHeight, Col opposite);
41 ImDrawList* drawList, ImVec2 startPos, ImVec2 endPos) const;
43 void ShowGrid() { m_ShowGrid = true; };
45 void HideGrid() { m_ShowGrid = false; };
49 bool GridVisibility() const { return m_ShowGrid; };
51 void SetGridWidth(int gridWidth) { m_GridWidth = gridWidth; }
53 void SetGridHeight(int gridHeight) { m_GridHeight = gridHeight; }
55 int GridWidth() const { return m_GridWidth; }
57 int GridHeight() const { return m_GridHeight; }
58
59 private:
62 bool m_ShowGrid{false};
64 };
65} // namespace FuncDoodle
ImGui/OpenGL/GLFW integration utilities and file dialog wrapper.
Defines pixel color structures and frame/image data containers.
int GridWidth() const
Returns the horizontal grid spacing.
Definition Grid.h:55
void HideGrid()
Hides the grid.
Definition Grid.h:45
void ShowGrid()
Makes the grid visible.
Definition Grid.h:43
void SetGridHeight(int gridHeight)
Updates the vertical grid spacing.
Definition Grid.h:53
void SetGridWidth(int gridWidth)
Updates the horizontal grid spacing.
Definition Grid.h:51
Grid(int gridWidth, int gridHeight, Col opposite)
Creates a grid overlay with the given cell size and contrast color.
Definition Grid.cc:38
void RenderWithDrawList(ImDrawList *drawList, ImVec2 startPos, ImVec2 endPos) const
Draws the grid into the provided ImGui draw list.
Definition Grid.cc:10
bool GridVisibility() const
Returns whether the grid is currently visible.
Definition Grid.h:49
void ToggleGrid()
Toggles grid visibility.
Definition Grid.h:47
int m_GridWidth
Definition Grid.h:60
int GridHeight() const
Returns the vertical grid spacing.
Definition Grid.h:57
Col m_OppositeCol
Definition Grid.h:63
int m_GridHeight
Definition Grid.h:61
bool m_ShowGrid
Definition Grid.h:62
The FuncDoodle C++ namespace.
Definition Common.h:12
A struct holding an RGB8 color.
Definition Frame.h:47