Putting a crosshair in
Putting a crosshair in
Heya, i'm new to Irrlicht (and very excited to use it), and new to programming in C++,i have done a few C++ tutorials and can understand it kinda well.anyhoo, i need some help implementing a crosshair, a .bmp one. i tried a few methods but the parts of the crosshair wasn't transparent, ie the black.i'm not really sure what to do tho, there is something missing, if anyone can help i would be much obliged.
ok, it looks like this code can be used
Code: Select all
gui::IGUIImage *crosshair;
rect<s32> crosshairDimensions(position2d<s32>(640/2,480/2),dimension2d<s32>(640 * 6,480 * 6));
crosshair=guienv->addImage(crosshairDimensions);
ITexture *tex=driver->getTexture("gui/crosshair.bmp");
crosshair->setImage(tex);
so if anyone has any other ideas bring them up
[/b]
well, i dont no if this will work, but u could try a billboard. not sure bout the code, but u could simply set the position of the billboard like
billposx=.1*sin(camangley);
billposy=.1*cos(camanglex);
billposz=.1*cos(camangley);
yes, i no that this is very inefficient, but the way described by the guest above apparently doesnt work, and thats the first way i would have tried.
(i think the sin and cos functions are under math.h under ur compiler)
billposx=.1*sin(camangley);
billposy=.1*cos(camanglex);
billposz=.1*cos(camangley);
yes, i no that this is very inefficient, but the way described by the guest above apparently doesnt work, and thats the first way i would have tried.
(i think the sin and cos functions are under math.h under ur compiler)
Code: Select all
// Load the image
tImage = driver->getTexture("crosshair.bmp");
// Set keycolor
driver->makeColorKeyTexture(tImage, position2d<s32>(0,0));
// Draw crosshair
driver->draw2DImage(tImage, position2d<s32>(iPositionX, iPositionY), rect<s32>(0, 0, 32, 32), 0, SColor(255,255,255,255), true);