diff options
Diffstat (limited to 'src/cguittfont')
-rw-r--r-- | src/cguittfont/CGUITTFont.cpp | 12 | ||||
-rw-r--r-- | src/cguittfont/CGUITTFont.h | 3 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/cguittfont/CGUITTFont.cpp b/src/cguittfont/CGUITTFont.cpp index fb8199e21..b9c979090 100644 --- a/src/cguittfont/CGUITTFont.cpp +++ b/src/cguittfont/CGUITTFont.cpp @@ -199,7 +199,7 @@ void SGUITTGlyph::unload() ////////////////////// -CGUITTFont* CGUITTFont::createTTFont(IGUIEnvironment *env, const io::path& filename, const u32 size, const bool antialias, const bool transparency) +CGUITTFont* CGUITTFont::createTTFont(IGUIEnvironment *env, const io::path& filename, const u32 size, const bool antialias, const bool transparency, const u32 shadow) { if (!c_libraryLoaded) { @@ -216,6 +216,8 @@ CGUITTFont* CGUITTFont::createTTFont(IGUIEnvironment *env, const io::path& filen return 0; } + font->shadow_offset = shadow; + return font; } @@ -625,6 +627,14 @@ void CGUITTFont::draw(const core::stringw& text, const core::rect<s32>& position CGUITTGlyphPage* page = n->getValue(); if (!use_transparency) color.color |= 0xff000000; + + if (shadow_offset) { + for (size_t i = 0; i < page->render_positions.size(); ++i) + page->render_positions[i] += core::vector2di(shadow_offset, shadow_offset); + Driver->draw2DImageBatch(page->texture, page->render_positions, page->render_source_rects, clip, video::SColor(255, 0, 0, 0), true); + for (size_t i = 0; i < page->render_positions.size(); ++i) + page->render_positions[i] -= core::vector2di(shadow_offset, shadow_offset); + } Driver->draw2DImageBatch(page->texture, page->render_positions, page->render_source_rects, clip, color, true); } } diff --git a/src/cguittfont/CGUITTFont.h b/src/cguittfont/CGUITTFont.h index 12e25e0f3..a58873da6 100644 --- a/src/cguittfont/CGUITTFont.h +++ b/src/cguittfont/CGUITTFont.h @@ -207,7 +207,7 @@ namespace gui //! \param antialias set the use_monochrome (opposite to antialias) flag //! \param transparency set the use_transparency flag //! \return Returns a pointer to a CGUITTFont. Will return 0 if the font failed to load. - static CGUITTFont* createTTFont(IGUIEnvironment *env, const io::path& filename, const u32 size, const bool antialias = true, const bool transparency = true); + static CGUITTFont* createTTFont(IGUIEnvironment *env, const io::path& filename, const u32 size, const bool antialias = true, const bool transparency = true, const u32 shadow = 0); static CGUITTFont* createTTFont(IrrlichtDevice *device, const io::path& filename, const u32 size, const bool antialias = true, const bool transparency = true); static CGUITTFont* create(IGUIEnvironment *env, const io::path& filename, const u32 size, const bool antialias = true, const bool transparency = true); static CGUITTFont* create(IrrlichtDevice *device, const io::path& filename, const u32 size, const bool antialias = true, const bool transparency = true); @@ -369,6 +369,7 @@ namespace gui s32 GlobalKerningWidth; s32 GlobalKerningHeight; core::ustring Invisible; + u32 shadow_offset; }; } // end namespace gui |