LCOV - code coverage report
Current view: top level - source/gui/ObjectTypes - CMiniMap.h (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 0 2 0.0 %
Date: 2023-01-19 00:18:29 Functions: 0 3 0.0 %

          Line data    Source code
       1             : /* Copyright (C) 2021 Wildfire Games.
       2             :  * This file is part of 0 A.D.
       3             :  *
       4             :  * 0 A.D. is free software: you can redistribute it and/or modify
       5             :  * it under the terms of the GNU General Public License as published by
       6             :  * the Free Software Foundation, either version 2 of the License, or
       7             :  * (at your option) any later version.
       8             :  *
       9             :  * 0 A.D. is distributed in the hope that it will be useful,
      10             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12             :  * GNU General Public License for more details.
      13             :  *
      14             :  * You should have received a copy of the GNU General Public License
      15             :  * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
      16             :  */
      17             : 
      18             : #ifndef INCLUDED_MINIMAP
      19             : #define INCLUDED_MINIMAP
      20             : 
      21             : #include "graphics/Color.h"
      22             : #include "graphics/Texture.h"
      23             : #include "gui/ObjectBases/IGUIObject.h"
      24             : #include "maths/Vector2D.h"
      25             : #include "renderer/VertexArray.h"
      26             : 
      27             : #include <deque>
      28             : #include <vector>
      29             : 
      30             : class CMatrix3D;
      31             : 
      32           0 : class CMiniMap : public IGUIObject
      33             : {
      34           0 :     GUI_OBJECT(CMiniMap)
      35             : 
      36             : public:
      37             :     CMiniMap(CGUI& pGUI);
      38             :     virtual ~CMiniMap();
      39             : 
      40             :     bool Flare(const CVector2D& pos, const CStr& colorStr);
      41             : 
      42             : protected:
      43             :     struct MapFlare
      44             :     {
      45             :         CVector2D pos;
      46             :         CColor color;
      47             :         double time;
      48             :     };
      49             : 
      50             :     virtual void Draw(CCanvas2D& canvas);
      51             : 
      52             :     virtual void CreateJSObject();
      53             : 
      54             :     /**
      55             :      * @see IGUIObject#HandleMessage()
      56             :      */
      57             :     virtual void HandleMessage(SGUIMessage& Message);
      58             : 
      59             :     /**
      60             :      * @see IGUIObject#IsMouseOver()
      61             :      */
      62             :     virtual bool IsMouseOver() const;
      63             : 
      64             : private:
      65             :     void SetCameraPositionFromMousePosition();
      66             : 
      67             :     bool FireWorldClickEvent(int button, int clicks);
      68             : 
      69             :     static const CStr EventNameWorldClick;
      70             : 
      71             :     // Whether or not the mouse is currently down
      72             :     bool m_Clicking;
      73             : 
      74             :     std::deque<MapFlare> m_MapFlares;
      75             : 
      76             :     std::vector<CTexturePtr> m_FlareTextures;
      77             : 
      78             :     CGUISimpleSetting<u32> m_FlareTextureCount;
      79             :     CGUISimpleSetting<u32> m_FlareRenderSize;
      80             :     CGUISimpleSetting<bool> m_FlareInterleave;
      81             :     CGUISimpleSetting<float> m_FlareAnimationSpeed;
      82             :     CGUISimpleSetting<float> m_FlareLifetimeSeconds;
      83             :     CGUISimpleSetting<float> m_FlareStartFadeSeconds;
      84             :     CGUISimpleSetting<float> m_FlareStopFadeSeconds;
      85             : 
      86             :     // Whether to draw a black square around and under the minimap.
      87             :     CGUISimpleSetting<bool> m_Mask;
      88             : 
      89             :     // map size
      90             :     ssize_t m_MapSize;
      91             : 
      92             :     // 1.f if map is circular or 1.414f if square (to shrink it inside the circle)
      93             :     float m_MapScale;
      94             : 
      95             :     void RecreateFlareTextures();
      96             : 
      97             :     void DrawViewRect(CCanvas2D& canvas) const;
      98             : 
      99             :     void DrawFlare(CCanvas2D& canvas, const MapFlare& flare, double currentTime) const;
     100             :     void DrawFlareFrame(CCanvas2D& canvas, const u32 frameIndex, const CRect& destination, const CColor& color, float alpha) const;
     101             : 
     102             :     void GetMouseWorldCoordinates(float& x, float& z) const;
     103             : 
     104             :     float GetAngle() const;
     105             :     CVector2D WorldSpaceToMiniMapSpace(const CVector3D& worldPosition) const;
     106             : };
     107             : 
     108             : #endif // INCLUDED_MINIMAP

Generated by: LCOV version 1.13