Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
CCmpSelectable Class Reference
Inheritance diagram for CCmpSelectable:
ICmpSelectable IComponent

Public Member Functions

 CCmpSelectable ()
 
 ~CCmpSelectable ()
 
virtual void Init (const CParamNode &paramNode)
 
virtual void Deinit ()
 
virtual void Serialize (ISerializer &serialize)
 
virtual void Deserialize (const CParamNode &paramNode, IDeserializer &deserialize)
 
virtual void HandleMessage (const CMessage &msg, bool global)
 
virtual void SetSelectionHighlight (CColor color, bool selected)
 Set the selection highlight state. More...
 
virtual void SetSelectionHighlightAlpha (float alpha)
 Set the alpha of the selection highlight. More...
 
virtual void SetVisibility (bool visible)
 Enables or disables rendering of an entity's selectable. More...
 
virtual bool IsEditorOnly ()
 Returns true if the entity is only selectable in Atlas editor, e.g. More...
 
void RenderSubmit (SceneCollector &collector)
 
void UpdateStaticOverlay ()
 Called from RenderSubmit if using a static outline; responsible for ensuring that the static overlay is up-to-date before it is rendered. More...
 
void UpdateDynamicOverlay (float frameOffset)
 Called from the interpolation handler; responsible for ensuring the dynamic overlay (provided we're using one) is up-to-date and ready to be submitted to the next rendering run. More...
 
void InvalidateStaticOverlay ()
 Explicitly invalidates the static overlay. More...
 
- Public Member Functions inherited from IComponent
virtual ~IComponent ()
 
CEntityHandle GetEntityHandle () const
 
void SetEntityHandle (CEntityHandle ent)
 
entity_id_t GetEntityId () const
 
CEntityHandle GetSystemEntity () const
 
const CSimContextGetSimContext () const
 
void SetSimContext (const CSimContext &context)
 
virtual JSClass * GetJSClass () const
 
virtual jsval GetJSInstance () const
 

Static Public Member Functions

static void ClassInit (CComponentManager &componentManager)
 
static IComponentAllocate (ScriptInterface &, jsval)
 
static void Deallocate (IComponent *cmp)
 
static std::string GetSchema ()
 
- Static Public Member Functions inherited from IComponent
static std::string GetSchema ()
 
static u8 GetSerializationVersion ()
 

Private Attributes

SOverlayDescriptor m_OverlayDescriptor
 
SOverlayTexturedLinem_BuildingOverlay
 
SOverlayQuadm_UnitOverlay
 
SOverlayLinem_DebugBoundingBoxOverlay
 
SOverlayLinem_DebugSelectionBoxOverlay
 
bool m_Visible
 
bool m_EditorOnly
 
bool m_AlwaysVisible
 
bool m_Selected
 Whether the parent entity is selected (caches GUI's selection state). More...
 
CColor m_Color
 Current selection overlay color. Alpha component is subject to fading. More...
 
bool m_Cached
 Whether the selectable's player colour has been cached for rendering. More...
 
float m_AlphaMin
 Minimum value for current selection overlay alpha. More...
 
float m_FadeBaselineAlpha
 Baseline alpha value to start fading from. Constant during a single fade. More...
 
float m_FadeDeltaAlpha
 Delta between target and baseline alpha. Constant during a single fade. Can be positive or negative. More...
 
float m_FadeProgress
 Linear time progress of the fade, between 0 and m_FadeDuration. More...
 

Static Private Attributes

static const double FADE_DURATION = 0.3
 Total duration of a single fade, in seconds. More...
 

Additional Inherited Members

- Public Types inherited from ICmpSelectable
enum  EOverlayType { DYNAMIC_QUAD, STATIC_OUTLINE }
 
- Static Public Attributes inherited from ICmpSelectable
static bool ms_EnableDebugOverlays = false
 

Detailed Description

Definition at line 51 of file CCmpSelectable.cpp.

Constructor & Destructor Documentation

CCmpSelectable::CCmpSelectable ( )
inline

Definition at line 66 of file CCmpSelectable.cpp.

CCmpSelectable::~CCmpSelectable ( )
inline

Definition at line 75 of file CCmpSelectable.cpp.

Member Function Documentation

static IComponent* CCmpSelectable::Allocate ( ScriptInterface ,
jsval   
)
inlinestatic

Definition at line 64 of file CCmpSelectable.cpp.

static void CCmpSelectable::ClassInit ( CComponentManager componentManager)
inlinestatic

Definition at line 54 of file CCmpSelectable.cpp.

static void CCmpSelectable::Deallocate ( IComponent cmp)
inlinestatic

Definition at line 64 of file CCmpSelectable.cpp.

virtual void CCmpSelectable::Deinit ( )
inlinevirtual

Implements IComponent.

Definition at line 151 of file CCmpSelectable.cpp.

virtual void CCmpSelectable::Deserialize ( const CParamNode paramNode,
IDeserializer deserialize 
)
inlinevirtual

Implements IComponent.

Definition at line 159 of file CCmpSelectable.cpp.

static std::string CCmpSelectable::GetSchema ( )
inlinestatic

Definition at line 83 of file CCmpSelectable.cpp.

void CCmpSelectable::HandleMessage ( const CMessage msg,
bool  global 
)
virtual

Reimplemented from IComponent.

Definition at line 267 of file CCmpSelectable.cpp.

virtual void CCmpSelectable::Init ( const CParamNode paramNode)
inlinevirtual

Implements IComponent.

Definition at line 113 of file CCmpSelectable.cpp.

void CCmpSelectable::InvalidateStaticOverlay ( )

Explicitly invalidates the static overlay.

Definition at line 338 of file CCmpSelectable.cpp.

virtual bool CCmpSelectable::IsEditorOnly ( )
inlinevirtual

Returns true if the entity is only selectable in Atlas editor, e.g.

a decorative visual actor.

Implements ICmpSelectable.

Definition at line 208 of file CCmpSelectable.cpp.

void CCmpSelectable::RenderSubmit ( SceneCollector collector)

Definition at line 526 of file CCmpSelectable.cpp.

virtual void CCmpSelectable::Serialize ( ISerializer serialize)
inlinevirtual

Implements IComponent.

Definition at line 153 of file CCmpSelectable.cpp.

virtual void CCmpSelectable::SetSelectionHighlight ( CColor  color,
bool  selected 
)
inlinevirtual

Set the selection highlight state.

The highlight is typically a circle/square overlay around the unit.

Parameters
colorcolor and alpha of the selection highlight. Set color.a = 0 to hide the highlight.
selectedwhether the entity is selected; affects desaturation for always visible highlights.

Implements ICmpSelectable.

Definition at line 167 of file CCmpSelectable.cpp.

virtual void CCmpSelectable::SetSelectionHighlightAlpha ( float  alpha)
inlinevirtual

Set the alpha of the selection highlight.

Set to 0 to hide the highlight.

Implements ICmpSelectable.

Definition at line 193 of file CCmpSelectable.cpp.

virtual void CCmpSelectable::SetVisibility ( bool  visible)
inlinevirtual

Enables or disables rendering of an entity's selectable.

Parameters
visibleWhether the selectable should be visible.

Implements ICmpSelectable.

Definition at line 203 of file CCmpSelectable.cpp.

void CCmpSelectable::UpdateDynamicOverlay ( float  frameOffset)

Called from the interpolation handler; responsible for ensuring the dynamic overlay (provided we're using one) is up-to-date and ready to be submitted to the next rendering run.

Definition at line 440 of file CCmpSelectable.cpp.

void CCmpSelectable::UpdateStaticOverlay ( )

Called from RenderSubmit if using a static outline; responsible for ensuring that the static overlay is up-to-date before it is rendered.

Has no effect unless the static overlay is explicitly marked as invalid first (see InvalidateStaticOverlay).

Definition at line 343 of file CCmpSelectable.cpp.

Member Data Documentation

const double CCmpSelectable::FADE_DURATION = 0.3
staticprivate

Total duration of a single fade, in seconds.

Assumed constant for now; feel free to change this into a member variable if you need to adjust it per component.

Definition at line 262 of file CCmpSelectable.cpp.

float CCmpSelectable::m_AlphaMin
private

Minimum value for current selection overlay alpha.

Definition at line 252 of file CCmpSelectable.cpp.

bool CCmpSelectable::m_AlwaysVisible
private

Definition at line 244 of file CCmpSelectable.cpp.

SOverlayTexturedLine* CCmpSelectable::m_BuildingOverlay
private

Definition at line 233 of file CCmpSelectable.cpp.

bool CCmpSelectable::m_Cached
private

Whether the selectable's player colour has been cached for rendering.

Definition at line 250 of file CCmpSelectable.cpp.

CColor CCmpSelectable::m_Color
private

Current selection overlay color. Alpha component is subject to fading.

Definition at line 248 of file CCmpSelectable.cpp.

SOverlayLine* CCmpSelectable::m_DebugBoundingBoxOverlay
private

Definition at line 236 of file CCmpSelectable.cpp.

SOverlayLine* CCmpSelectable::m_DebugSelectionBoxOverlay
private

Definition at line 237 of file CCmpSelectable.cpp.

bool CCmpSelectable::m_EditorOnly
private

Definition at line 242 of file CCmpSelectable.cpp.

float CCmpSelectable::m_FadeBaselineAlpha
private

Baseline alpha value to start fading from. Constant during a single fade.

Definition at line 254 of file CCmpSelectable.cpp.

float CCmpSelectable::m_FadeDeltaAlpha
private

Delta between target and baseline alpha. Constant during a single fade. Can be positive or negative.

Definition at line 256 of file CCmpSelectable.cpp.

float CCmpSelectable::m_FadeProgress
private

Linear time progress of the fade, between 0 and m_FadeDuration.

Definition at line 258 of file CCmpSelectable.cpp.

SOverlayDescriptor CCmpSelectable::m_OverlayDescriptor
private

Definition at line 232 of file CCmpSelectable.cpp.

bool CCmpSelectable::m_Selected
private

Whether the parent entity is selected (caches GUI's selection state).

Definition at line 246 of file CCmpSelectable.cpp.

SOverlayQuad* CCmpSelectable::m_UnitOverlay
private

Definition at line 234 of file CCmpSelectable.cpp.

bool CCmpSelectable::m_Visible
private

Definition at line 240 of file CCmpSelectable.cpp.


The documentation for this class was generated from the following file: