Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/ICmpSelectable.h
/* Copyright (C) 2017 Wildfire Games. | /* Copyright (C) 2018 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
Show All 16 Lines | |||||
{ | { | ||||
public: | public: | ||||
/** | /** | ||||
* Returns true if the entity is only selectable in Atlas editor, e.g. a decorative visual actor. | * Returns true if the entity is only selectable in Atlas editor, e.g. a decorative visual actor. | ||||
*/ | */ | ||||
virtual bool IsEditorOnly() const = 0; | virtual bool IsEditorOnly() const = 0; | ||||
/** | /** | ||||
* Set the selection highlight state. | * Sets the selection highlight state. | ||||
elexis: The comment might be pointless, but it was grammatically correct, no? But the s doesn't hurt… | |||||
Not Done Inline ActionsDoesn't really matter, was just making the tense consistent since I was here. temple: Doesn't really matter, was just making the tense consistent since I was here. | |||||
* The highlight is typically a circle/square overlay around the unit. | * The highlight is typically a circle/square overlay around the unit. | ||||
* @param color color and alpha of the selection highlight. Set color.a = 0 to hide the highlight. | * @param color color and alpha of the selection highlight. Set color.a = 0 to hide the highlight. | ||||
* @param selected whether the entity is selected; affects desaturation for always visible highlights. | * @param selected whether the entity is selected; affects desaturation for always visible highlights. | ||||
*/ | */ | ||||
virtual void SetSelectionHighlight(const CColor& color, bool selected) = 0; | virtual void SetSelectionHighlight(const CColor& color, bool selected) = 0; | ||||
/** | /** | ||||
* Enables or disables rendering of an entity's selectable. | * Enables or disables rendering of an entity's selectable. | ||||
* @param visible Whether the selectable should be visible. | * @param visible Whether the selectable should be visible. | ||||
*/ | */ | ||||
virtual void SetVisibility(bool visible) = 0; | virtual void SetVisibility(bool visible) = 0; | ||||
/** | /** | ||||
* Enables or disables rendering of all entities selectable. | * Enables or disables rendering of all entities selectable. | ||||
* @param visible Whether the selectable should be visible. | * @param visible Whether the selectable should be visible. | ||||
*/ | */ | ||||
static void SetOverrideVisibility(bool visible) | static void SetOverrideVisibility(bool visible) | ||||
{ | { | ||||
ICmpSelectable::m_OverrideVisible = visible; | ICmpSelectable::m_OverrideVisible = visible; | ||||
} | } | ||||
/** | /** | ||||
* Set the alpha of the selection highlight. Set to 0 to hide the highlight. | * Updates the selection color to match the current owner. | ||||
*/ | |||||
virtual void UpdateColor() = 0; | |||||
/** | |||||
* Sets the alpha of the selection highlight. Set to 0 to hide the highlight. | |||||
*/ | */ | ||||
virtual void SetSelectionHighlightAlpha(float alpha) = 0; | virtual void SetSelectionHighlightAlpha(float alpha) = 0; | ||||
DECLARE_INTERFACE_TYPE(Selectable) | DECLARE_INTERFACE_TYPE(Selectable) | ||||
// TODO: this is slightly ugly design; it would be nice to change the component system to support per-component-type data | // TODO: this is slightly ugly design; it would be nice to change the component system to support per-component-type data | ||||
// and methods, where we can keep settings like these. Note that any such data store would need to be per-component-manager | // and methods, where we can keep settings like these. Note that any such data store would need to be per-component-manager | ||||
// and not entirely global, to support multiple simulation instances. | // and not entirely global, to support multiple simulation instances. | ||||
static bool ms_EnableDebugOverlays; // ms for member static | static bool ms_EnableDebugOverlays; // ms for member static | ||||
protected: | protected: | ||||
static bool m_OverrideVisible; | static bool m_OverrideVisible; | ||||
}; | }; | ||||
#endif // INCLUDED_ICMPSELECTABLE | #endif // INCLUDED_ICMPSELECTABLE |
Wildfire Games · Phabricator
The comment might be pointless, but it was grammatically correct, no? But the s doesn't hurt either.