Add IGUIEnvironment::removeFont (requested regularly).

Note: Currently we still will have the font-texture for CGUIFont's in the cache afterward.
But that needs a more general mechanims that allows cleaning up textures easier when the last one has been removed.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3465 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2010-12-02 22:14:44 +00:00
parent 7e20fd0d06
commit ac1d878aac
4 changed files with 23 additions and 0 deletions

View File

@ -1,5 +1,7 @@
Changes in 1.8 (??.0?.2010) Changes in 1.8 (??.0?.2010)
- Add function IGUIEnvironment::removeFont
- Functions in IMeshCache expecting IAnimatedMesh* parameters removed as similar functions with IMesh* can be used since a while. Fixes also problems when IAnimatedMesh* got upcasted to IMesh*. (thx @ Greenya for reporting) - Functions in IMeshCache expecting IAnimatedMesh* parameters removed as similar functions with IMesh* can be used since a while. Fixes also problems when IAnimatedMesh* got upcasted to IMesh*. (thx @ Greenya for reporting)
- The following functions will now use a "ISceneNode *" instead of a "const ISceneNode *": - The following functions will now use a "ISceneNode *" instead of a "const ISceneNode *":

View File

@ -174,6 +174,9 @@ public:
\return Pointer to the font stored. This can differ from given parameter if the name previously existed. */ \return Pointer to the font stored. This can differ from given parameter if the name previously existed. */
virtual IGUIFont* addFont(const io::path& name, IGUIFont* font) = 0; virtual IGUIFont* addFont(const io::path& name, IGUIFont* font) = 0;
//! remove loaded font
virtual void removeFont(IGUIFont* font) = 0;
//! Returns the default built-in font. //! Returns the default built-in font.
/** \return Pointer to the default built-in font. /** \return Pointer to the default built-in font.
This pointer should not be dropped. See IReferenceCounted::drop() for This pointer should not be dropped. See IReferenceCounted::drop() for

View File

@ -1481,6 +1481,21 @@ IGUIFont* CGUIEnvironment::addFont(const io::path& name, IGUIFont* font)
return font; return font;
} }
//! remove loaded font
void CGUIEnvironment::removeFont(IGUIFont* font)
{
if ( !font )
return;
for ( u32 i=0; i<Fonts.size(); ++i )
{
if ( Fonts[i].Font == font )
{
Fonts[i].Font->drop();
Fonts.erase(i);
return;
}
}
}
//! returns default font //! returns default font
IGUIFont* CGUIEnvironment::getBuiltInFont() const IGUIFont* CGUIEnvironment::getBuiltInFont() const

View File

@ -80,6 +80,9 @@ public:
//! add an externally loaded font //! add an externally loaded font
virtual IGUIFont* addFont(const io::path& name, IGUIFont* font); virtual IGUIFont* addFont(const io::path& name, IGUIFont* font);
//! remove loaded font
virtual void removeFont(IGUIFont* font);
//! returns default font //! returns default font
virtual IGUIFont* getBuiltInFont() const; virtual IGUIFont* getBuiltInFont() const;