2D Graphics Drawing HUD

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
mubashar
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

2D Graphics Drawing HUD

Post by mubashar »

I am working on racing game project now its time to draw hud to show racing meter .. i am using two transparent images

Image

Code: Select all

ITexture* image_meter = driver->getTexture("media/2D/speedometer_base.png");
ITexture* image_needle = driver->getTexture("media/2D/speedometer_arrow.png");material.MaterialType = irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL;
                  driver->setTransform(irr::video::ETS_VIEW,irr::core::matrix4());
                    driver->setTransform(irr::video::ETS_PROJECTION,irr::core::matrix4());
                  driver->setMaterial(material);
                driver->draw2DImage(image_meter,vector2d<s32>(RX/1.15,RY/1.2),rect<s32>(0,0,image_meter->getSize().Width/2,image_meter->getSize().Height/2),0,SColor(255,255,255,255),true);
                driver->draw2DImage(image_needle,vector2d<s32>(RX/1.15,RY/1.2),rect<s32>(0,0,image_needle->getSize().Width/2,image_needle->getSize().Height/2),0,SColor(255,255,255,255),true);
Now what i want to do is rotate "image_needle" and i have no idea how can i do this i have read 2d graphics tutorial but didn't help so can any one please help me here .... i just want to know how to rotate image than i will adjust its value with speed .... thank you :)
When it's all over, it's not who you were. It's whether you made a difference
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: 2D Graphics Drawing HUD

Post by CuteAlien »

IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
mubashar
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: 2D Graphics Drawing HUD

Post by mubashar »

@CuteAlien It Helps Thanks :)
When it's all over, it's not who you were. It's whether you made a difference
smso
Posts: 246
Joined: Fri Jun 04, 2010 3:28 pm
Location: Hong Kong

Re: 2D Graphics Drawing HUD

Post by smso »

An oop way is to subclass gui::IGUIElement.

You may take a look at vitek's CGUICompass for example:
http://irrlicht.sourceforge.net/forum/v ... 386#177386

Regards
smso
Post Reply