Add ITextSceneNode::setFont.

IBillboardTextSceneNode has now it's own type (was using same type as ITextSceneNode before). See Bug #197.
But serialization of both text-nodes still not working (needs font-serialization).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5373 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2017-03-20 17:00:36 +00:00
parent 83be80032b
commit 2882711b7f
6 changed files with 27 additions and 2 deletions

View File

@ -3,7 +3,7 @@ Changes in 1.9 (not yet released)
- Fix IBillboardTextSceneNode::setTextColor which did nothing in the past. It now maps to setColor instead.
- Add access functions to IBillboardTextSceneNode (getText, getFont).
- Add access functions to ITextSceneNode (getText, getTextColor, getFont).
- Add access functions to ITextSceneNode (getText, getTextColor, setFont, getFont).
- Try harder to move Window to custom WindowPosition set in SIrrlichtCreationParameters on X11. Thx@ Hernan Ezequiel Di Giorgi for the patch (#304).
- Fix bug in virtual filessystem which prevented createFileList from working. Thx @Cube for reporting a problem.
- ITriangleSelector now can also return meshbuffer collision information.

View File

@ -30,6 +30,9 @@ namespace scene
//! Text Scene Node
ESNT_TEXT = MAKE_IRR_ID('t','e','x','t'),
//! Billboard text scene node
ESNT_BILLBOARD_TEXT = MAKE_IRR_ID('b','t','x','t'),
//! Water Surface Scene Node
ESNT_WATER_SURFACE = MAKE_IRR_ID('w','a','t','r'),

View File

@ -40,6 +40,9 @@ public:
//! get the color of the text
virtual video::SColor getTextColor() const = 0;
//! set the font used to draw the text
virtual void setFont(gui::IGUIFont* font) = 0;
//! Get the font used to draw the text
virtual gui::IGUIFont* getFont() const = 0;
};

View File

@ -5,6 +5,7 @@
#include "CDefaultSceneNodeFactory.h"
#include "ISceneManager.h"
#include "ITextSceneNode.h"
#include "IBillboardTextSceneNode.h"
#include "ITerrainSceneNode.h"
#include "IDummyTransformationSceneNode.h"
#include "ICameraSceneNode.h"
@ -33,6 +34,7 @@ CDefaultSceneNodeFactory::CDefaultSceneNodeFactory(ISceneManager* mgr)
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_CUBE, "cube"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_SPHERE, "sphere"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_TEXT, "text"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_BILLBOARD_TEXT, "billboardText"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_WATER_SURFACE, "waterSurface"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_TERRAIN, "terrain"));
SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_SKY_BOX, "skyBox"));
@ -70,6 +72,8 @@ ISceneNode* CDefaultSceneNodeFactory::addSceneNode(ESCENE_NODE_TYPE type, IScene
return Manager->addSphereSceneNode(5, 16, parent);
case ESNT_TEXT:
return Manager->addTextSceneNode(0, L"example");
case ESNT_BILLBOARD_TEXT:
return Manager->addBillboardTextSceneNode(0, L"example");
case ESNT_WATER_SURFACE:
return Manager->addWaterSurfaceSceneNode(0, 2.0f, 300.0f, 10.0f, parent);
case ESNT_TERRAIN:

View File

@ -95,6 +95,18 @@ video::SColor CTextSceneNode::getTextColor() const
return Color;
}
void CTextSceneNode::setFont(gui::IGUIFont* font)
{
if ( font != Font )
{
if ( font )
font->grab();
if ( Font )
Font->drop();
Font = font;
}
}
//! Get the font used to draw the text
gui::IGUIFont* CTextSceneNode::getFont() const
{

View File

@ -50,6 +50,9 @@ namespace scene
//! get the color of the text
virtual video::SColor getTextColor() const _IRR_OVERRIDE_;
//! set the font used to draw the text
virtual void setFont(gui::IGUIFont* font) _IRR_OVERRIDE_;
//! Get the font used to draw the text
virtual gui::IGUIFont* getFont() const _IRR_OVERRIDE_;
@ -110,7 +113,7 @@ namespace scene
virtual u32 getMaterialCount() const _IRR_OVERRIDE_;
//! Returns type of the scene node
virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_TEXT; }
virtual ESCENE_NODE_TYPE getType() const _IRR_OVERRIDE_ { return ESNT_BILLBOARD_TEXT; }
//! Set the color of all vertices of the billboard
//! \param overallColor: the color to set