| 1 | #ifndef GAME_EDITOR_MAP_VIEW_H |
| 2 | #define GAME_EDITOR_MAP_VIEW_H |
| 3 | |
| 4 | #include "component.h" |
| 5 | #include "map_grid.h" |
| 6 | #include "proof_mode.h" |
| 7 | #include "smooth_value.h" |
| 8 | |
| 9 | #include <base/vmath.h> |
| 10 | |
| 11 | class CLayerGroup; |
| 12 | |
| 13 | class CMapView : public CEditorComponent |
| 14 | { |
| 15 | public: |
| 16 | void OnInit(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 RenderEditorMap(); |
| 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 | float GetWorldZoom() const; |
| 40 | |
| 41 | void OffsetWorld(vec2 Offset); |
| 42 | void OffsetEditor(vec2 Offset); |
| 43 | void SetWorldOffset(vec2 WorldOffset); |
| 44 | void SetEditorOffset(vec2 EditorOffset); |
| 45 | vec2 GetWorldOffset() const; |
| 46 | vec2 GetEditorOffset() const; |
| 47 | |
| 48 | CSmoothValue *Zoom(); |
| 49 | const CSmoothValue *Zoom() const; |
| 50 | CProofMode *ProofMode(); |
| 51 | const CProofMode *ProofMode() const; |
| 52 | CMapGrid *MapGrid(); |
| 53 | const CMapGrid *MapGrid() const; |
| 54 | |
| 55 | private: |
| 56 | CSmoothValue m_Zoom = CSmoothValue(200.0f, 10.0f, 2000.0f); |
| 57 | float m_WorldZoom; |
| 58 | |
| 59 | CProofMode m_ProofMode; |
| 60 | CMapGrid m_MapGrid; |
| 61 | |
| 62 | vec2 m_WorldOffset; |
| 63 | vec2 m_EditorOffset; |
| 64 | }; |
| 65 | |
| 66 | #endif |
| 67 | |