When I put the HP(Life) bar picture on the screen...is their any way that I can cut piece of it out...to make the HP Bar looks like it was decreased...or do I have to make another picture in photoshop and switch to it....Or in case of bullet..if I want to display many bullet pic on screen..do I have to duplicate them and put it side by side? and how can I take it off one by one...
sample...imagine that "I" is bullet....
first, before the gun was shot===> IIIIIIIIII
second,after it was shot 3 times==> IIIIIII
How to put the 2D pic like HP on the screen of the camera?
Yes, look in the 2dgraphics example, driver->draw2dimage should be what you're looking for, you can choose a rect of an image to only draw part of it... I've used it in a menu system to draw multiple buttons from the same image.
New RF2 website at: http://realityfactory2.sourceforge.net/
You can call this function each game loop:
Pass in the current amount to be displayed as a percentage. (20 & 650 are screen x y co-ordinates where ammo bar is positioned, change these to defines or const int's or whatever)
________
Weed vaporizers
Code: Select all
irr::video::ITexture* m_pAmmoBar;
...
//! Display horizontal ammo bar. Ammo as a percentage is shown
//! 100 max ammo, zero none. Ammo image 256 x 64 and represents
//! a row of 10 bullets
void CGamePlayState::displayAmmoBar(irr::s32 percent)
{
irr::core::rect< irr::s32 > clip(20, 650, 20 + (256 * percent/100) , 650 + 64);
smgr->getDriver()->draw2DImage(m_pAmmoBar, irr::core::position2d< irr::s32 >(20,650),
irr::core::rect< irr::s32 >(0,0,256,128),
&clip, irr::video::SColor(255, 255, 255, 255), true);
}
Pass in the current amount to be displayed as a percentage. (20 & 650 are screen x y co-ordinates where ammo bar is positioned, change these to defines or const int's or whatever)
________
Weed vaporizers