mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-22 23:26:15 +00:00
Handle shadow outline in gui
This commit is contained in:
parent
523761d7b7
commit
a1262b71b2
6 changed files with 72 additions and 4 deletions
|
@ -381,6 +381,7 @@ namespace NLGUI
|
|||
|
||||
bool _CloseSubMenuUsingPopModal;
|
||||
bool _Shadow;
|
||||
bool _ShadowOutline;
|
||||
bool _Formatted;
|
||||
uint8 _Space;
|
||||
sint32 _FontSize;
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace NLGUI
|
|||
|
||||
/// Constructor
|
||||
CViewText (const std::string& id, const std::string Text="", sint FontSize=12,
|
||||
NLMISC::CRGBA Color=NLMISC::CRGBA(255,255,255), bool Shadow=false);
|
||||
NLMISC::CRGBA Color=NLMISC::CRGBA(255,255,255), bool Shadow=false, bool ShadowOutline=false);
|
||||
|
||||
virtual ~CViewText();
|
||||
|
||||
|
@ -83,6 +83,7 @@ namespace NLGUI
|
|||
void setFontSize (sint nFontSize);
|
||||
void setColor (const NLMISC::CRGBA &color);
|
||||
void setShadow (bool bShadow);
|
||||
void setShadowOutline (bool bShadowOutline);
|
||||
void setShadowColor (const NLMISC::CRGBA &color);
|
||||
void setLineMaxW (sint nMaxW, bool invalidate=true);
|
||||
void setMultiLine (bool bMultiLine);
|
||||
|
@ -102,6 +103,7 @@ namespace NLGUI
|
|||
sint getFontSize() const;
|
||||
NLMISC::CRGBA getColor() { return _Color; }
|
||||
bool getShadow() { return _Shadow; }
|
||||
bool getShadowOutline() { return _ShadowOutline; }
|
||||
NLMISC::CRGBA getShadowColor() { return _ShadowColor; }
|
||||
sint getLineMaxW() const { return _LineMaxW; }
|
||||
bool getMultiLine() const { return _MultiLine; }
|
||||
|
@ -225,6 +227,7 @@ namespace NLGUI
|
|||
NLMISC::CRGBA _Color;
|
||||
/// the shadow mode
|
||||
bool _Shadow;
|
||||
bool _ShadowOutline;
|
||||
/// the case mode
|
||||
TCaseMode _CaseMode;
|
||||
/// the text shadow color
|
||||
|
|
|
@ -3713,6 +3713,7 @@ namespace NLGUI
|
|||
_TitleOpened->setParentPosRef (Hotspot_TL);
|
||||
_TitleOpened->setPosRef (Hotspot_TL);
|
||||
_TitleOpened->setShadow (true);
|
||||
_TitleOpened->setShadowOutline (false);
|
||||
_TitleOpened->setColor (CRGBA(255,255,255,255));
|
||||
_TitleOpened->setModulateGlobalColor(getModulateGlobalColor());
|
||||
_TitleOpened->setOverExtendViewText(_TitleOverExtendViewText);
|
||||
|
@ -3764,6 +3765,7 @@ namespace NLGUI
|
|||
_TitleClosed->setParentPosRef (Hotspot_TL);
|
||||
_TitleClosed->setPosRef (Hotspot_TL);
|
||||
_TitleClosed->setShadow (true);
|
||||
_TitleClosed->setShadowOutline (false);
|
||||
_TitleClosed->setColor (CRGBA(255,255,255,255));
|
||||
_TitleClosed->setModulateGlobalColor(getModulateGlobalColor());
|
||||
_TitleClosed->setOverExtendViewText(_TitleOverExtendViewText);
|
||||
|
|
|
@ -1203,6 +1203,7 @@ namespace NLGUI
|
|||
pV->setColor (_GroupMenu->_Color);
|
||||
pV->setFontSize (_GroupMenu->_FontSize);
|
||||
pV->setShadow (_GroupMenu->_Shadow);
|
||||
pV->setShadowOutline (_GroupMenu->_ShadowOutline);
|
||||
pV->setCheckable(checkable);
|
||||
pV->setChecked(checked);
|
||||
pV->setModulateGlobalColor(_GroupMenu->_ModulateGlobalColor);
|
||||
|
@ -1282,6 +1283,7 @@ namespace NLGUI
|
|||
pV->setColor (_GroupMenu->_Color);
|
||||
pV->setFontSize (_GroupMenu->_FontSize);
|
||||
pV->setShadow (_GroupMenu->_Shadow);
|
||||
pV->setShadowOutline (_GroupMenu->_ShadowOutline);
|
||||
pV->setCheckable(checkable);
|
||||
pV->setChecked(checked);
|
||||
pV->setModulateGlobalColor(_GroupMenu->_ModulateGlobalColor);
|
||||
|
@ -1922,6 +1924,7 @@ namespace NLGUI
|
|||
_HighLightOver.set(128, 0, 0, 255);
|
||||
_FontSize = 12;
|
||||
_Shadow = false;
|
||||
_ShadowOutline = false;
|
||||
_ResizeFromChildH = _ResizeFromChildW = true;
|
||||
_DisplayFrame = false;
|
||||
_RootMenu = NULL;
|
||||
|
@ -1998,6 +2001,11 @@ namespace NLGUI
|
|||
return toString( _Shadow );
|
||||
}
|
||||
else
|
||||
if( name == "shadow_outline" )
|
||||
{
|
||||
return toString( _ShadowOutline );
|
||||
}
|
||||
else
|
||||
if( name == "formatted" )
|
||||
{
|
||||
return toString( _Formatted );
|
||||
|
@ -2110,6 +2118,14 @@ namespace NLGUI
|
|||
return;
|
||||
}
|
||||
else
|
||||
if( name == "shadow_outline" )
|
||||
{
|
||||
bool b;
|
||||
if( fromString( value, b ) )
|
||||
_ShadowOutline = b;
|
||||
return;
|
||||
}
|
||||
else
|
||||
if( name == "formatted" )
|
||||
{
|
||||
bool b;
|
||||
|
@ -2152,6 +2168,7 @@ namespace NLGUI
|
|||
xmlSetProp( node, BAD_CAST "space", BAD_CAST toString( _Space ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "fontsize", BAD_CAST toString( _FontSize ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "shadow", BAD_CAST toString( _Shadow ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "shadow_outline", BAD_CAST toString( _ShadowOutline ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "formatted", BAD_CAST toString( _Formatted ).c_str() );
|
||||
|
||||
if( _RootMenu == NULL )
|
||||
|
@ -2197,6 +2214,7 @@ namespace NLGUI
|
|||
_Color = gm->_Color;
|
||||
_ShadowColor = gm->_ShadowColor;
|
||||
_Shadow = gm->_Shadow;
|
||||
_ShadowOutline = gm->_ShadowOutline;
|
||||
_FontSize = gm->_FontSize;
|
||||
_ColorOver = gm->_ColorOver;
|
||||
_ShadowColorOver = gm->_ShadowColorOver;
|
||||
|
@ -2266,6 +2284,10 @@ namespace NLGUI
|
|||
if (prop)
|
||||
_Shadow = convertBool(prop);
|
||||
|
||||
prop = (char*) xmlGetProp( in, (xmlChar*)"shadow_outline" );
|
||||
if (prop)
|
||||
_ShadowOutline = convertBool(prop);
|
||||
|
||||
prop = (char*) xmlGetProp( in, (xmlChar*)"formatted" );
|
||||
if (prop)
|
||||
_Formatted = convertBool(prop);
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace NLGUI
|
|||
CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont ).getValSInt32();
|
||||
_Color = CRGBA(255,255,255,255);
|
||||
_Shadow = false;
|
||||
_ShadowOutline = false;
|
||||
_ShadowColor = CRGBA(0,0,0,255);
|
||||
|
||||
_MultiLine = false;
|
||||
|
@ -111,7 +112,7 @@ namespace NLGUI
|
|||
///constructor
|
||||
// ***************************************************************************
|
||||
CViewText:: CViewText (const std::string& id, const std::string Text, sint FontSize,
|
||||
NLMISC::CRGBA Color, bool Shadow)
|
||||
NLMISC::CRGBA Color, bool Shadow, bool ShadowOutline)
|
||||
:CViewBase(TCtorParam())
|
||||
{
|
||||
_Id = id;
|
||||
|
@ -120,6 +121,7 @@ namespace NLGUI
|
|||
_FontSize = FontSize + CWidgetManager::getInstance()->getSystemOption( CWidgetManager::OptionAddCoefFont).getValSInt32();
|
||||
_Color = Color;
|
||||
_Shadow = Shadow;
|
||||
_ShadowOutline = ShadowOutline;
|
||||
setText(Text);
|
||||
computeFontSize ();
|
||||
}
|
||||
|
@ -159,6 +161,7 @@ namespace NLGUI
|
|||
_FontSize = vt._FontSize;
|
||||
_Color = vt._Color;
|
||||
_Shadow = vt._Shadow;
|
||||
_ShadowOutline = vt._ShadowOutline;
|
||||
_ShadowColor = vt._ShadowColor;
|
||||
|
||||
_MultiLine = false;
|
||||
|
@ -225,6 +228,11 @@ namespace NLGUI
|
|||
return toString( _Shadow );
|
||||
}
|
||||
else
|
||||
if( name == "shadow_outline" )
|
||||
{
|
||||
return toString( _ShadowOutline );
|
||||
}
|
||||
else
|
||||
if( name == "shadow_color" )
|
||||
{
|
||||
return toString( _ShadowColor );
|
||||
|
@ -360,6 +368,14 @@ namespace NLGUI
|
|||
return true;
|
||||
}
|
||||
else
|
||||
if( name == "shadow_outline" )
|
||||
{
|
||||
bool b;
|
||||
if( fromString( value, b ) )
|
||||
_ShadowOutline = b;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if( name == "shadow_color" )
|
||||
{
|
||||
CRGBA c;
|
||||
|
@ -520,6 +536,7 @@ namespace NLGUI
|
|||
).c_str() );
|
||||
|
||||
xmlSetProp( node, BAD_CAST "shadow", BAD_CAST toString( _Shadow ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "shadow_outline", BAD_CAST toString( _ShadowOutline ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "shadow_color", BAD_CAST toString( _ShadowColor ).c_str() );
|
||||
xmlSetProp( node, BAD_CAST "multi_line", BAD_CAST toString( _MultiLine ).c_str() );
|
||||
|
||||
|
@ -604,6 +621,11 @@ namespace NLGUI
|
|||
if (prop)
|
||||
_Shadow = convertBool(prop);
|
||||
|
||||
prop = (char*) xmlGetProp( cur, (xmlChar*)"shadow_outline" );
|
||||
_ShadowOutline = false;
|
||||
if (prop)
|
||||
_ShadowOutline = convertBool(prop);
|
||||
|
||||
prop= (char*) xmlGetProp( cur, (xmlChar*)"shadow_color" );
|
||||
_ShadowColor = CRGBA(0,0,0,255);
|
||||
if (prop)
|
||||
|
@ -864,6 +886,7 @@ namespace NLGUI
|
|||
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setShadeColor (shcol);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
|
||||
|
@ -978,6 +1001,7 @@ namespace NLGUI
|
|||
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setShadeColor (shcol);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
|
||||
|
@ -1146,6 +1170,14 @@ namespace NLGUI
|
|||
invalidateContent();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CViewText::setShadowOutline (bool bShadowOutline)
|
||||
{
|
||||
_ShadowOutline = bShadowOutline;
|
||||
computeFontSize ();
|
||||
invalidateContent();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CViewText::setShadowColor(const NLMISC::CRGBA & color)
|
||||
{
|
||||
|
@ -1647,6 +1679,7 @@ namespace NLGUI
|
|||
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
|
||||
// default state
|
||||
|
@ -1958,6 +1991,7 @@ namespace NLGUI
|
|||
NL3D::UTextContext *TextContext = CViewRenderer::getTextContext();
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
// CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||
height = getFontHeight();
|
||||
|
@ -2089,6 +2123,7 @@ namespace NLGUI
|
|||
// setup the text context
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
// find the line where the character is
|
||||
// CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||
|
@ -2363,6 +2398,7 @@ namespace NLGUI
|
|||
NL3D::UTextContext *TextContext = CViewRenderer::getTextContext();
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
|
||||
TCharPos linePos = 0;
|
||||
|
@ -2447,6 +2483,7 @@ namespace NLGUI
|
|||
NL3D::UTextContext *TextContext = CViewRenderer::getTextContext();
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
|
||||
// Current position in text
|
||||
|
@ -2498,12 +2535,13 @@ namespace NLGUI
|
|||
NL3D::UTextContext *TextContext = CViewRenderer::getTextContext();
|
||||
TextContext->setHotSpot (UTextContext::BottomLeft);
|
||||
TextContext->setShaded (_Shadow);
|
||||
TextContext->setShadeOutline (_ShadowOutline);
|
||||
TextContext->setFontSize (_FontSize);
|
||||
|
||||
// Letter size
|
||||
UTextContext::CStringInfo si = TextContext->getStringInfo(ucstring("|")); // for now we can't now that directly from UTextContext
|
||||
_FontHeight = (uint) si.StringHeight + (_Shadow?1:0);
|
||||
_FontLegHeight = (uint) si.StringLine + (_Shadow?1:0);
|
||||
_FontHeight = (uint) si.StringHeight + (_Shadow?(_ShadowOutline?2:1):0);
|
||||
_FontLegHeight = (uint) si.StringLine + (_Shadow?(_ShadowOutline?2:1):0);
|
||||
|
||||
// Space width
|
||||
si = TextContext->getStringInfo(ucstring(" "));
|
||||
|
@ -2960,6 +2998,7 @@ namespace NLGUI
|
|||
f.serial(_SpaceWidth);
|
||||
f.serial(_Color);
|
||||
f.serial(_Shadow);
|
||||
f.serial(_ShadowOutline);
|
||||
f.serialEnum(_CaseMode);
|
||||
f.serial(_ShadowColor);
|
||||
f.serial(_LineMaxW);
|
||||
|
|
|
@ -1186,6 +1186,7 @@ namespace NLGUI
|
|||
vtDst->setColor (vtSrc->getColor());
|
||||
vtDst->setModulateGlobalColor(vtSrc->getModulateGlobalColor());
|
||||
vtDst->setShadow(vtSrc->getShadow());
|
||||
vtDst->setShadowOutline(vtSrc->getShadowOutline());
|
||||
vtDst->setShadowColor(vtSrc->getShadowColor());
|
||||
vtDst->setCaseMode(vtSrc->getCaseMode());
|
||||
vtDst->setUnderlined(vtSrc->getUnderlined());
|
||||
|
|
Loading…
Reference in a new issue