Disable text shadow on selection text (closes ryzom/ryzomcore#214

feature/change-sound-driver-ingame
Nimetu 3 years ago
parent ba003ee45d
commit f13c49219e

@ -118,6 +118,8 @@ namespace NLGUI
// Force only a subset of letter to be displayed. Default is 0/0xFFFFFFFF // Force only a subset of letter to be displayed. Default is 0/0xFFFFFFFF
void enableStringSelection(uint start, uint end); void enableStringSelection(uint start, uint end);
void disableStringSelection(); void disableStringSelection();
void setShadowInSelection(bool s) { m_DisableShadowInSelection = !s; }
bool getShadowInSelection() const { return !m_DisableShadowInSelection; }
/// Get /// Get
std::string getText() const { return _HardText.empty() ? _Text : _HardText; } std::string getText() const { return _HardText.empty() ? _Text : _HardText; }
@ -448,6 +450,7 @@ namespace NLGUI
bool _StrikeThrough : 1; bool _StrikeThrough : 1;
bool _ContinuousUpdate : 1; bool _ContinuousUpdate : 1;
bool _Setuped : 1; bool _Setuped : 1;
bool m_DisableShadowInSelection : 1;
uint _TextSelectionStart; uint _TextSelectionStart;
uint _TextSelectionEnd; uint _TextSelectionEnd;

@ -755,6 +755,9 @@ namespace NLGUI
// Display the selection if needed // Display the selection if needed
if (_CurrSelection == this && _SelectCursorPos!=_CursorPos) if (_CurrSelection == this && _SelectCursorPos!=_CursorPos)
{ {
// flush so that selection quad is covering text
rVR.flush();
sint32 blankTextId= rVR.getBlankTextureId(); sint32 blankTextId= rVR.getBlankTextureId();
CRGBA col= _BackSelectColor; CRGBA col= _BackSelectColor;
col.A= CWidgetManager::getInstance()->getGlobalColorForContent().A; col.A= CWidgetManager::getInstance()->getGlobalColorForContent().A;

@ -99,6 +99,7 @@ namespace NLGUI
_TextSelection= false; _TextSelection= false;
_TextSelectionStart= 0; _TextSelectionStart= 0;
_TextSelectionEnd= std::numeric_limits<uint>::max(); _TextSelectionEnd= std::numeric_limits<uint>::max();
m_DisableShadowInSelection = true;
_InvalidTextContext= true; _InvalidTextContext= true;
_FirstLineX = 0; _FirstLineX = 0;
@ -1188,9 +1189,10 @@ namespace NLGUI
{ {
if (_Lines.empty()) return; if (_Lines.empty()) return;
bool drawShadow = !(_TextSelection && m_DisableShadowInSelection);
TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setHotSpot (UTextContext::BottomLeft);
TextContext->setShaded (_Shadow); TextContext->setShaded (_Shadow && drawShadow);
TextContext->setShadeOutline (_ShadowOutline); TextContext->setShadeOutline (_ShadowOutline && drawShadow);
TextContext->setShadeColor (shcol); TextContext->setShadeColor (shcol);
TextContext->setShadeExtent (_ShadowX*oow, _ShadowY*ooh); TextContext->setShadeExtent (_ShadowX*oow, _ShadowY*ooh);
TextContext->setFontSize (_FontSize*_Scale); TextContext->setFontSize (_FontSize*_Scale);
@ -1320,9 +1322,10 @@ namespace NLGUI
{ {
nlassert(_Index != 0xFFFFFFFF); nlassert(_Index != 0xFFFFFFFF);
bool drawShadow = !(_TextSelection && m_DisableShadowInSelection);
TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setHotSpot (UTextContext::BottomLeft);
TextContext->setShaded (_Shadow); TextContext->setShaded (_Shadow && drawShadow);
TextContext->setShadeOutline (_ShadowOutline); TextContext->setShadeOutline (_ShadowOutline && drawShadow);
TextContext->setShadeColor (shcol); TextContext->setShadeColor (shcol);
TextContext->setShadeExtent (_ShadowX*oow, _ShadowY*ooh); TextContext->setShadeExtent (_ShadowX*oow, _ShadowY*ooh);
TextContext->setFontSize (_FontSize*_Scale); TextContext->setFontSize (_FontSize*_Scale);

Loading…
Cancel
Save