![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Singleton grid-snapping helper. More...
#include <GridSnapping.h>
Public Member Functions | |
| bool | IsEnabled () const |
| void | SetEnabled (bool enabled) |
| void | Toggle () |
| Toggles snapping on/off. | |
| int | GetGridSize () const |
| Returns the current grid cell size in pixels (default: 16). | |
| void | SetGridSize (int size) |
| Sets the grid cell size. | |
| float | SnapX (float x) const |
| Snaps a single x coordinate to the nearest grid line. | |
| float | SnapY (float y) const |
| Snaps a single y coordinate to the nearest grid line. | |
| void | Snap (float &x, float &y) const |
| Snaps both x and y coordinates in place. | |
Static Public Member Functions | |
| static GridSnapping & | Get () |
| Returns the single shared instance. | |
Private Member Functions | |
| GridSnapping () | |
Private Attributes | |
| bool | m_Enabled |
| int | m_GridSize |
Singleton grid-snapping helper.
Typical usage:
Definition at line 36 of file GridSnapping.h.
|
private |
Definition at line 28 of file GridSnapping.cpp.
|
static |
Returns the single shared instance.
Definition at line 18 of file GridSnapping.cpp.
| int Olympe::GridSnapping::GetGridSize | ( | ) | const |
Returns the current grid cell size in pixels (default: 16).
Definition at line 57 of file GridSnapping.cpp.
References m_GridSize.
| bool Olympe::GridSnapping::IsEnabled | ( | ) | const |
Definition at line 38 of file GridSnapping.cpp.
References m_Enabled.
Definition at line 43 of file GridSnapping.cpp.
References m_Enabled.
Sets the grid cell size.
Values <= 0 are ignored.
Definition at line 62 of file GridSnapping.cpp.
References m_GridSize.
Snaps both x and y coordinates in place.
Definition at line 90 of file GridSnapping.cpp.
References SnapX(), and SnapY().
Here is the call graph for this function:Snaps a single x coordinate to the nearest grid line.
Definition at line 72 of file GridSnapping.cpp.
References GetComponentTypeID_Static(), m_Enabled, and m_GridSize.
Referenced by Snap().
Here is the call graph for this function:
Here is the caller graph for this function:Snaps a single y coordinate to the nearest grid line.
Definition at line 81 of file GridSnapping.cpp.
References GetComponentTypeID_Static(), m_Enabled, and m_GridSize.
Referenced by Snap().
Here is the call graph for this function:
Here is the caller graph for this function:| void Olympe::GridSnapping::Toggle | ( | ) |
|
private |
Definition at line 97 of file GridSnapping.h.
Referenced by IsEnabled(), SetEnabled(), SnapX(), SnapY(), and Toggle().
|
private |
Definition at line 98 of file GridSnapping.h.
Referenced by GetGridSize(), SetGridSize(), SnapX(), and SnapY().