| 1 | #ifndef GAME_EDITOR_MAP_GRID_H |
| 2 | #define GAME_EDITOR_MAP_GRID_H |
| 3 | |
| 4 | #include "component.h" |
| 5 | |
| 6 | #include <game/client/ui.h> |
| 7 | |
| 8 | class CMapGrid : public CEditorComponent |
| 9 | { |
| 10 | public: |
| 11 | void OnReset() override; |
| 12 | void OnRender(CUIRect View) override; |
| 13 | |
| 14 | void SnapToGrid(vec2 &Position) const; |
| 15 | int GridLineDistance() const; |
| 16 | |
| 17 | /** |
| 18 | * Returns whether the grid is rendered. |
| 19 | */ |
| 20 | bool IsEnabled() const; |
| 21 | |
| 22 | void Toggle(); |
| 23 | |
| 24 | int Factor() const; |
| 25 | void SetFactor(int Factor); |
| 26 | |
| 27 | void (vec2 Position); |
| 28 | |
| 29 | private: |
| 30 | bool m_GridActive; |
| 31 | int m_GridFactor; |
| 32 | |
| 33 | SPopupMenuId ; |
| 34 | static CUi::EPopupMenuFunctionResult (void *pContext, CUIRect View, bool Active); |
| 35 | }; |
| 36 | |
| 37 | #endif |
| 38 | |