Fixed strange selection ring fadeout on unit deselection in Atlas
This was SVN commit r11634.
This commit is contained in:
parent
4830cebf5e
commit
61fad4a2b5
@ -147,10 +147,14 @@ public:
|
|||||||
m_Color.r = color.r;
|
m_Color.r = color.r;
|
||||||
m_Color.g = color.g;
|
m_Color.g = color.g;
|
||||||
m_Color.b = color.b;
|
m_Color.b = color.b;
|
||||||
|
SetSelectionHighlightAlpha(color.a);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void SetSelectionHighlightAlpha(float alpha)
|
||||||
|
{
|
||||||
// set up fading from the current value (as the baseline) to the target value
|
// set up fading from the current value (as the baseline) to the target value
|
||||||
m_FadeBaselineAlpha = m_Color.a;
|
m_FadeBaselineAlpha = m_Color.a;
|
||||||
m_FadeDeltaAlpha = color.a - m_FadeBaselineAlpha;
|
m_FadeDeltaAlpha = alpha - m_FadeBaselineAlpha;
|
||||||
m_FadeProgress = 0.f;
|
m_FadeProgress = 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,10 +54,15 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the color of the selection highlight (typically a circle/square
|
* Set the color of the selection highlight (typically a circle/square
|
||||||
* around the unit). Set a = 0 to disable.
|
* around the unit). Set a = 0 to disable the highlight.
|
||||||
*/
|
*/
|
||||||
virtual void SetSelectionHighlight(CColor color) = 0;
|
virtual void SetSelectionHighlight(CColor color) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the alpha of the selection highlight. Set to 0 to disable the highlight.
|
||||||
|
*/
|
||||||
|
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
|
||||||
|
@ -111,8 +111,7 @@ MESSAGEHANDLER(SetSelectionPreview)
|
|||||||
{
|
{
|
||||||
CmpPtr<ICmpSelectable> cmpSelectable(sim, g_Selection[i]);
|
CmpPtr<ICmpSelectable> cmpSelectable(sim, g_Selection[i]);
|
||||||
if (cmpSelectable)
|
if (cmpSelectable)
|
||||||
// TODO: change only alpha component
|
cmpSelectable->SetSelectionHighlightAlpha(0);
|
||||||
cmpSelectable->SetSelectionHighlight(CColor(1, 1, 1, 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_Selection = *msg->ids;
|
g_Selection = *msg->ids;
|
||||||
|
Loading…
Reference in New Issue
Block a user