Played with a shadow feature to the fonts; not used now, but leaving the code in just in case we ever want that (and it's sorta likely to happen); the code also doesn't hurt to stay there if unused
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4244 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
aa003ef977
commit
f3f9829336
@ -28,6 +28,7 @@ ScalableFont::ScalableFont(IGUIEnvironment *env, const io::path& filename)
|
||||
#endif
|
||||
|
||||
m_scale = 1.0f;
|
||||
m_shadow = false;
|
||||
|
||||
if (Environment)
|
||||
{
|
||||
@ -57,8 +58,12 @@ ScalableFont::~ScalableFont()
|
||||
if (SpriteBank)
|
||||
SpriteBank->drop();
|
||||
}
|
||||
|
||||
|
||||
void ScalableFont::setShadow(irr::video::SColor col)
|
||||
{
|
||||
m_shadow = true;
|
||||
m_shadow_color = col;
|
||||
}
|
||||
|
||||
//! loads a font file from xml
|
||||
bool ScalableFont::load(io::IXMLReader* xml)
|
||||
{
|
||||
@ -487,6 +492,19 @@ void ScalableFont::draw(const core::stringw& text, const core::rect<s32>& positi
|
||||
if (!Driver)
|
||||
return;
|
||||
|
||||
if (m_shadow)
|
||||
{
|
||||
m_shadow = false; // avoid infinite recursion
|
||||
|
||||
core::rect<s32> shadowpos = position;
|
||||
shadowpos.LowerRightCorner.X += 2;
|
||||
shadowpos.LowerRightCorner.Y += 2;
|
||||
|
||||
draw(text, shadowpos, m_shadow_color, hcenter, vcenter, clip);
|
||||
|
||||
m_shadow = true; // set back
|
||||
}
|
||||
|
||||
//color = video::SColor(255,255,255,255);
|
||||
|
||||
core::dimension2d<s32> textDimension;
|
||||
|
@ -31,6 +31,8 @@ namespace gui
|
||||
class ScalableFont : public IGUIFontBitmap
|
||||
{
|
||||
float m_scale;
|
||||
bool m_shadow;
|
||||
irr::video::SColor m_shadow_color;
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
@ -70,6 +72,8 @@ public:
|
||||
virtual s32 getKerningWidth(const wchar_t* thisLetter=0, const wchar_t* previousLetter=0) const;
|
||||
virtual s32 getKerningHeight() const;
|
||||
|
||||
void setShadow(irr::video::SColor col);
|
||||
|
||||
//! gets the sprite bank
|
||||
virtual IGUISpriteBank* getSpriteBank() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user