Pyrogenesis  trunk
ICmpOverlayRenderer.h
Go to the documentation of this file.
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 
22 
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  */
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  static void SetOverrideVisibility(bool visible)
60  {
62  }
63 
65 
66 protected:
67  static bool m_OverrideVisible;
68 };
69 
70 #endif // INCLUDED_ICMPOVERLAYRENDERER
Definition: IComponent.h:33
Definition: FixedVector2D.h:24
Class OverlayRenderer: Render various bits of data that overlay the game world (selection circles...
Definition: OverlayRenderer.h:36
static void SetOverrideVisibility(bool visible)
Enables or disables rendering of all sprites.
Definition: ICmpOverlayRenderer.h:59
virtual void Reset()=0
Delete all sprites that have been previously added.
Definition: path.h:77
virtual void AddSprite(const VfsPath &textureName, const CFixedVector2D &corner0, const CFixedVector2D &corner1, const CFixedVector3D &offset, const std::string &color="255 255 255 255")=0
Add a new textured billboard sprite to be rendered.
Definition: FixedVector3D.h:24
#define DECLARE_INTERFACE_TYPE(iname)
Definition: Interface.h:23
static bool m_OverrideVisible
Definition: ICmpOverlayRenderer.h:67
Entity coordinate types.
Interface for rendering &#39;overlay&#39; objects (typically sprites), automatically positioned relative to t...
Definition: ICmpOverlayRenderer.h:37