Crosshair
-
- Posts: 164
- Joined: Wed May 05, 2004 5:34 pm
- Location: Germany Berlin
- Contact:
1024x768
for a solution of 1024x768
looks like this
Code: Select all
driver->draw2DRectangle( irr::video::SColor(100,100,200,100), irr::core::rect<s32>(511,372,513,378) ); //above
driver->draw2DRectangle( irr::video::SColor(100,100,200,100), irr::core::rect<s32>(518,383,524,385) ); //right
driver->draw2DRectangle( irr::video::SColor(100,100,200,100), irr::core::rect<s32>(511,390,513,396) ); //down
driver->draw2DRectangle( irr::video::SColor(100,100,200,100), irr::core::rect<s32>(500,383,506,385) ); //left
Last edited by LordNaikon on Wed Jul 07, 2004 9:56 am, edited 1 time in total.
q|^.^|p beeing every time friendly to everyone
sys: 2500+Barton 512MB 6600GT WinXP
sys: 2500+Barton 512MB 6600GT WinXP
-
- Posts: 164
- Joined: Wed May 05, 2004 5:34 pm
- Location: Germany Berlin
- Contact:
What you could also do, because you have to account for other screen sizes, if you want the cross hair in the middle of the screen, you can do something like:
This will position the cursor in the middle of the screen.
Code: Select all
irr::core::position2d<irr::f32> pos = Cursor->getRelativePosition();
// keep cursor in the middle of the screen
pos.X = 0.5f;
pos.Y = 0.5f;
Cursor->setPosition(pos);
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
-Japanese Proverb
Why you get position of a cursor and then overwrite it with new valuse. To keep cursor in the meedle of the screen this is sufficient:
Code: Select all
Cursor->setPosition(irr::core::position2d<irr::f32>(0.5f,0.5f));
Tomasz Nowakowski
Openoko - www.openoko.pl
Openoko - www.openoko.pl
Oh, yeah, okay. That does make more sense.
I was just changing someone else's code, which generally I do on a mostly line by line basis, because its occasionally hard to see where someone is going with it. (occasionally, but admitedly not in this case )
I was just changing someone else's code, which generally I do on a mostly line by line basis, because its occasionally hard to see where someone is going with it. (occasionally, but admitedly not in this case )
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
-Japanese Proverb
If you use a camera that traps the cursor, it may jump around a bit more than you'd want a crosshair to. I haven't actually tried it, so maybe it wouldn't be a problem, but the cursor with the irrlicht fps camera appears to jump around a bit
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.
Crucible of Stars
Crucible of Stars
-
- Posts: 164
- Joined: Wed May 05, 2004 5:34 pm
- Location: Germany Berlin
- Contact:
This'l add your crosshair no probs buddy....
Code: Select all
scene::ISceneNode* crosshair = 0;
crosshair = smgr->addBillboardSceneNode(crosshair,
core::dimension2d<f32>(10, 10));
crosshair->setMaterialFlag(video::EMF_LIGHTING, false);
crosshair->setMaterialTexture(0, driver->getTexture
("../../Textures/crosshair1.bmp"));
crosshair->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
crosshair->setPosition(core::vector3df(0,0,150));
camera->addChild(crosshair);
-
- Posts: 24
- Joined: Fri Oct 28, 2005 10:05 am
- Location: Gold Coast, QLD, Australia
-
- Posts: 33
- Joined: Sat Aug 05, 2006 9:46 pm
A little addition to this 2yrs old code
Code: Select all
crosshair->setMaterialFlag(video::EMF_ZBUFFER, false);
under construction