Cursor on a fps

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
DanyATK
Posts: 32
Joined: Mon Mar 22, 2004 8:40 pm
Location: Italy
Contact:

Cursor on a fps

Post by DanyATK »

Hello, i've got another problem:

I must make a cursor for my fps. I've used this function to set the image for cursor:

Code: Select all

ITexture* mirino = driver->getTexture("mirino.bmp");
driver->makeColorKeyTexture(mirino, position2d<s32>(0,0));
And in while cycle ( while(device->run()&& driver) ) i'v write:

Code: Select all

position2d<s32> mouse = device->getCursorControl()->getPosition();
driver->draw2DImage(mirino, position2d<s32>(mouse.X,mouse.Y), rect<s32>(0,0,25,25));
Ok, the code work! but, the img used for cursor isn't correctly displayed and, when I move the mouse, it shakes considerably... why?

I use the first person shooter camera ( smgr->addCameraSceneNodeFPS(); )

Thx :wink:
PadrinatoR
Posts: 50
Joined: Tue Mar 09, 2004 9:53 pm
Location: Spain

Post by PadrinatoR »

Well, if it's a FPS game... why do you not draw the image always in the center of your screen?
There are only 10 types of people: those who understand binary and those who don't

--------------------------------------------

Image
DanyATK
Posts: 32
Joined: Mon Mar 22, 2004 8:40 pm
Location: Italy
Contact:

Post by DanyATK »

:D You have reason, I had not thought! :wink:

But... why the cursor isn't displayed correctly? (25x25 bmp 24 bit file)
And... How I can display the cursor on top of all 3D models?

Thx
Peter Müller
Posts: 292
Joined: Sun Mar 14, 2004 5:28 pm
Location: Germany
Contact:

Post by Peter Müller »

And... How I can display the cursor on top of all 3D models?
By drawing it last
http://www.games-forge.de - Die Community für Nachwuchsprogrammierer
DanyATK
Posts: 32
Joined: Mon Mar 22, 2004 8:40 pm
Location: Italy
Contact:

Post by DanyATK »

Thanks :wink: , now, my cursor is at top of all objects! :D
PadrinatoR
Posts: 50
Joined: Tue Mar 09, 2004 9:53 pm
Location: Spain

Post by PadrinatoR »

DanyATK wrote::D You have reason, I had not thought! :wink:

But... why the cursor isn't displayed correctly? (25x25 bmp 24 bit file)
And... How I can display the cursor on top of all 3D models?

Thx
I said that because I don't know why it's shaking xDDD (why is it shaking or why it is shaking?? My English is poop xDD)
There are only 10 types of people: those who understand binary and those who don't

--------------------------------------------

Image
DanyATK
Posts: 32
Joined: Mon Mar 22, 2004 8:40 pm
Location: Italy
Contact:

Post by DanyATK »

XD ... also my english is poop XD
The best italian GM related site
www.gamemaker.it
Peter Müller
Posts: 292
Joined: Sun Mar 14, 2004 5:28 pm
Location: Germany
Contact:

Post by Peter Müller »

Welcome in the club DanyATK and PadrinatoR.
@PadrinatoR:
Can you post some Spanish words (e.g. f*ck, ash)
I'm learning it in school and I don't like me teacher ;)
http://www.games-forge.de - Die Community für Nachwuchsprogrammierer
DanyATK
Posts: 32
Joined: Mon Mar 22, 2004 8:40 pm
Location: Italy
Contact:

Post by DanyATK »

lol
The best italian GM related site
www.gamemaker.it
PadrinatoR
Posts: 50
Joined: Tue Mar 09, 2004 9:53 pm
Location: Spain

Post by PadrinatoR »

Peter Müller wrote:ash, ass, looked to much pokemon ;) (don't take serious!)
I thought that too xDD
There are only 10 types of people: those who understand binary and those who don't

--------------------------------------------

Image
bappy
Posts: 63
Joined: Fri Dec 12, 2003 10:49 am
Location: france
Contact:

Post by bappy »

you should use this for drawing in the center of the screen:

driver->draw2DImage(mirino, position2d<s32>((ScreenWidth/2)-(ImageCursorWidth/2),(ScreenHeight/2)-(ImageHeight/2)), rect<s32>(0,0,25,25));

of course you should store (ScreenWidth/2)-(ImageCursorWidth/2)
and (ScreenHeight/2)-(ImageHeight/2) in a variable for not calculate it each time :)
-----------------------------
Sans danger, pas de gloire...
http;//bappy.free.fr
-----------------------------
Peter Müller
Posts: 292
Joined: Sun Mar 14, 2004 5:28 pm
Location: Germany
Contact:

Post by Peter Müller »

@padrinator:
Today I told my teacher your words :D - he knew them :(
But seeing his reaction was worth
http://www.games-forge.de - Die Community für Nachwuchsprogrammierer
PadrinatoR
Posts: 50
Joined: Tue Mar 09, 2004 9:53 pm
Location: Spain

Post by PadrinatoR »

Peter Müller wrote:@padrinator:
Today I told my teacher your words :D - he knew them :(
But seeing his reaction was worth
xDDDDDDDDD
You should have recorded it and give me that video xDDD
There are only 10 types of people: those who understand binary and those who don't

--------------------------------------------

Image
Peter Müller
Posts: 292
Joined: Sun Mar 14, 2004 5:28 pm
Location: Germany
Contact:

Post by Peter Müller »

Jup, it would be great, if i'd recorded it
http://www.games-forge.de - Die Community für Nachwuchsprogrammierer
Post Reply