Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ICmpSelectable.h
Go to the documentation of this file.
1 /* Copyright (C) 2012 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_ICMPSELECTABLE
19 #define INCLUDED_ICMPSELECTABLE
20 
21 #include "ps/CStrIntern.h"
23 
24 struct CColor;
25 
26 class ICmpSelectable : public IComponent
27 {
28 public:
29 
30  enum EOverlayType {
31  /// A single textured quad overlay, intended for entities that move around much, like units (e.g. foot soldiers, etc).
33  /// A more complex textured line overlay, composed of several textured line segments. Intended for entities that do not
34  /// move often, such as buildings (structures).
36  };
37 
39  {
46 
48  };
49 
50  /**
51  * Returns true if the entity is only selectable in Atlas editor, e.g. a decorative visual actor.
52  */
53  virtual bool IsEditorOnly() = 0;
54 
55  /**
56  * Set the selection highlight state.
57  * The highlight is typically a circle/square overlay around the unit.
58  * @param color color and alpha of the selection highlight. Set color.a = 0 to hide the highlight.
59  * @param selected whether the entity is selected; affects desaturation for always visible highlights.
60  */
61  virtual void SetSelectionHighlight(CColor color, bool selected) = 0;
62 
63  /**
64  * Enables or disables rendering of an entity's selectable.
65  * @param visible Whether the selectable should be visible.
66  */
67  virtual void SetVisibility(bool visible) = 0;
68 
69  /**
70  * Set the alpha of the selection highlight. Set to 0 to hide the highlight.
71  */
72  virtual void SetSelectionHighlightAlpha(float alpha) = 0;
73 
74  DECLARE_INTERFACE_TYPE(Selectable)
75 
76  // TODO: this is slightly ugly design; it would be nice to change the component system to support per-component-type data
77  // and methods, where we can keep settings like these. Note that any such data store would need to be per-component-manager
78  // and not entirely global, to support multiple simulation instances.
79  static bool ms_EnableDebugOverlays; // ms for member static
80 };
81 
82 #endif // INCLUDED_ICMPSELECTABLE
A single textured quad overlay, intended for entities that move around much, like units (e...
static bool ms_EnableDebugOverlays
Definition: Overlay.h:34
virtual bool IsEditorOnly()=0
Returns true if the entity is only selectable in Atlas editor, e.g.
virtual void SetSelectionHighlight(CColor color, bool selected)=0
Set the selection highlight state.
Interned 8-bit strings.
Definition: CStrIntern.h:37
#define DECLARE_INTERFACE_TYPE(iname)
Definition: Interface.h:23
A more complex textured line overlay, composed of several textured line segments. ...
virtual void SetVisibility(bool visible)=0
Enables or disables rendering of an entity&#39;s selectable.
virtual void SetSelectionHighlightAlpha(float alpha)=0
Set the alpha of the selection highlight.