Code: Select all
#include <irrlicht.h>
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
class CAircraftSymbol : public scene::ISceneNode
{
core::aabbox3d<f32> Box;
public:
CAircraftSymbol(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id)
: scene::ISceneNode(parent, mgr, id),center(0,0,0),
lLeft(0, 0, 0), uLeft(0, 0, 10), uRight(10, 0, 10), lRight(10, 0, 0)
{
mtl.Lighting = false;
// default symbol color is white
mtl.AmbientColor = mtl.DiffuseColor = mtl.EmissiveColor = SColor(110,255,255,255);
}
virtual void OnPreRender()
{
if (IsVisible)
SceneManager->registerNodeForRendering(this);
ISceneNode::OnPreRender();
}
virtual void render()
{
IVideoDriver* driver = SceneManager->getVideoDriver();
driver->setTransform(ETS_WORLD, AbsoluteTransformation);
driver->setMaterial(mtl);
// aircraft rectangle symbol
driver->draw3DLine(lLeft, uLeft, mtl.AmbientColor);
driver->draw3DLine(uLeft, uRight, mtl.AmbientColor);
driver->draw3DLine(uRight, lRight, mtl.AmbientColor);
driver->draw3DLine(lRight, lLeft, mtl.AmbientColor);
}
virtual const core::aabbox3d<f32>& getBoundingBox() const
{
return Box;
}
virtual s32 getMaterialCount()
{
return 1;
}
virtual SMaterial& getMaterial(s32 i)
{
return mtl;
}
core::vector3df center, lLeft, uLeft, uRight, lRight;
f32 radius, size;
SMaterial mtl;
};
Code: Select all
SceneManager->addTextSceneNode(guienv->getBuiltInFont(), L" SOME TEXT GOES HERE ", SColor(255,255,255,255), Parent);
or how to get pointer to my custom font inside custom scene node ?
like in 2dGraphic example:
Code: Select all
gui::IGUIFont* font2 = device->getGUIEnvironment()->getFont("../../media/fonthaettenschweiler.bmp");
Thanks in advance.