LCOV - code coverage report
Current view: top level - source/simulation2/components - ICmpOverlayRenderer.h (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 4 5 80.0 %
Date: 2023-01-19 00:18:29 Functions: 2 5 40.0 %

          Line data    Source code
       1             : /* Copyright (C) 2015 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_ICMPOVERLAYRENDERER
      19             : #define INCLUDED_ICMPOVERLAYRENDERER
      20             : 
      21             : #include "simulation2/system/Interface.h"
      22             : 
      23             : #include "simulation2/helpers/Position.h"
      24             : 
      25             : #include "lib/file/vfs/vfs_path.h"
      26             : #include "maths/FixedVector2D.h"
      27             : #include "maths/FixedVector3D.h"
      28             : 
      29             : /**
      30             :  * Interface for rendering 'overlay' objects (typically sprites), automatically
      31             :  * positioned relative to the entity.
      32             :  * Usually driven by the StatusBars component.
      33             :  *
      34             :  * (TODO: maybe we should add a "category" argument to Reset/AddSprite/etc,
      35             :  * so different components can each maintain independent sets of overlays here?)
      36             :  */
      37           0 : class ICmpOverlayRenderer : public IComponent
      38             : {
      39             : public:
      40             :     /**
      41             :      * Delete all sprites that have been previously added.
      42             :      */
      43             :     virtual void Reset() = 0;
      44             : 
      45             :     /**
      46             :      * Add a new textured billboard sprite to be rendered.
      47             :      * @param textureName filename of texture to render.
      48             :      * @param corner0,corner1 coordinates of sprite's corners, in world-space units oriented with the camera plane,
      49             :      *        relative to the sprite position.
      50             :      * @param offset world-space offset of sprite position from the entity's base position.
      51             :      * @param color multiply color of texture
      52             :      */
      53             :     virtual void AddSprite(const VfsPath& textureName, const CFixedVector2D& corner0, const CFixedVector2D& corner1, const CFixedVector3D& offset, const std::string& color = "255 255 255 255") = 0;
      54             : 
      55             :     /**
      56             :     * Enables or disables rendering of all sprites.
      57             :     * @param visible Whether the selectable should be visible.
      58             :     */
      59           2 :     static void SetOverrideVisibility(bool visible)
      60             :     {
      61           2 :         ICmpOverlayRenderer::m_OverrideVisible = visible;
      62           2 :     }
      63             : 
      64         116 :     DECLARE_INTERFACE_TYPE(OverlayRenderer)
      65             : 
      66             : protected:
      67             :     static bool m_OverrideVisible;
      68             : };
      69             : 
      70             : #endif // INCLUDED_ICMPOVERLAYRENDERER

Generated by: LCOV version 1.13