1 | #ifndef GAME_EDITOR_MAP_VIEW_H |
2 | #define GAME_EDITOR_MAP_VIEW_H |
3 | |
4 | #include <base/vmath.h> |
5 | |
6 | #include "component.h" |
7 | #include "map_grid.h" |
8 | #include "proof_mode.h" |
9 | #include "smooth_value.h" |
10 | |
11 | class CLayerGroup; |
12 | |
13 | class CMapView : public CEditorComponent |
14 | { |
15 | public: |
16 | void Init(CEditor *pEditor) override; |
17 | void OnReset() override; |
18 | void OnMapLoad() override; |
19 | |
20 | void ZoomMouseTarget(float ZoomFactor); |
21 | void UpdateZoom(); |
22 | |
23 | void RenderGroupBorder(); |
24 | void RenderMap(); |
25 | |
26 | bool IsFocused(); |
27 | void Focus(); |
28 | |
29 | /** |
30 | * Reset zoom and editor offset. |
31 | */ |
32 | void ResetZoom(); |
33 | |
34 | /** |
35 | * Scale length according to zoom value. |
36 | */ |
37 | float ScaleLength(float Value) const; |
38 | |
39 | bool m_ShowPicker; // TODO: make private |
40 | |
41 | float GetWorldZoom() const; |
42 | |
43 | void OffsetWorld(vec2 Offset); |
44 | void OffsetEditor(vec2 Offset); |
45 | void SetWorldOffset(vec2 WorldOffset); |
46 | void SetEditorOffset(vec2 EditorOffset); |
47 | vec2 GetWorldOffset() const; |
48 | vec2 GetEditorOffset() const; |
49 | |
50 | CSmoothValue *Zoom(); |
51 | const CSmoothValue *Zoom() const; |
52 | CProofMode *ProofMode(); |
53 | const CProofMode *ProofMode() const; |
54 | CMapGrid *MapGrid(); |
55 | const CMapGrid *MapGrid() const; |
56 | |
57 | private: |
58 | CSmoothValue m_Zoom = CSmoothValue(200.0f, 10.0f, 2000.0f); |
59 | float m_WorldZoom; |
60 | |
61 | CProofMode m_ProofMode; |
62 | CMapGrid m_MapGrid; |
63 | |
64 | vec2 m_WorldOffset; |
65 | vec2 m_EditorOffset; |
66 | }; |
67 | |
68 | #endif |
69 | |