Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
ICmpSelectable.h
Go to the documentation of this file.
1/* Copyright (C) 2018 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
22
23struct CColor;
24
26{
27public:
28 /**
29 * Returns true if the entity is only selectable in Atlas editor, e.g. a decorative visual actor.
30 */
31 virtual bool IsEditorOnly() const = 0;
32
33 /**
34 * Sets the selection highlight state.
35 * The highlight is typically a circle/square overlay around the unit.
36 * @param color color and alpha of the selection highlight. Set color.a = 0 to hide the highlight.
37 * @param selected whether the entity is selected; affects desaturation for always visible highlights.
38 */
39 virtual void SetSelectionHighlight(const CColor& color, bool selected) = 0;
40
41 /**
42 * Enables or disables rendering of an entity's selectable.
43 * @param visible Whether the selectable should be visible.
44 */
45 virtual void SetVisibility(bool visible) = 0;
46
47 /**
48 * Enables or disables rendering of all entities selectable.
49 * @param visible Whether the selectable should be visible.
50 */
51 static void SetOverrideVisibility(bool visible)
52 {
54 }
55
56 /**
57 * Updates the selection color to match the current owner.
58 */
59 virtual void UpdateColor() = 0;
60
61 /**
62 * Sets the alpha of the selection highlight. Set to 0 to hide the highlight.
63 */
64 virtual void SetSelectionHighlightAlpha(float alpha) = 0;
65
66 DECLARE_INTERFACE_TYPE(Selectable)
67
68 // TODO: this is slightly ugly design; it would be nice to change the component system to support per-component-type data
69 // and methods, where we can keep settings like these. Note that any such data store would need to be per-component-manager
70 // and not entirely global, to support multiple simulation instances.
71 static bool ms_EnableDebugOverlays; // ms for member static
72
73protected:
74 static bool m_OverrideVisible;
75};
76
77#endif // INCLUDED_ICMPSELECTABLE
#define DECLARE_INTERFACE_TYPE(iname)
Definition: Interface.h:23
Definition: ICmpSelectable.h:26
static void SetOverrideVisibility(bool visible)
Enables or disables rendering of all entities selectable.
Definition: ICmpSelectable.h:51
static bool m_OverrideVisible
Definition: ICmpSelectable.h:74
virtual void UpdateColor()=0
Updates the selection color to match the current owner.
virtual void SetSelectionHighlight(const CColor &color, bool selected)=0
Sets the selection highlight state.
virtual void SetVisibility(bool visible)=0
Enables or disables rendering of an entity's selectable.
static bool ms_EnableDebugOverlays
Definition: ICmpSelectable.h:71
virtual bool IsEditorOnly() const =0
Returns true if the entity is only selectable in Atlas editor, e.g.
virtual void SetSelectionHighlightAlpha(float alpha)=0
Sets the alpha of the selection highlight.
Definition: IComponent.h:33
Definition: Color.h:43