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
8class CMapGrid : public CEditorComponent
9{
10public:
11 void OnReset() override;
12 void OnRender(CUIRect View) override;
13
14 void SnapToGrid(float &x, float &y) 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 DoSettingsPopup(vec2 Position);
28
29private:
30 bool m_GridActive;
31 int m_GridFactor;
32
33 SPopupMenuId m_PopupGridSettingsId;
34 static CUi::EPopupMenuFunctionResult PopupGridSettings(void *pContext, CUIRect View, bool Active);
35};
36
37#endif
38