Customised Cursor - not quite working :)

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
WhytWulf
Posts: 51
Joined: Mon Sep 08, 2003 11:14 am
Location: Australia, Tamworth, NSW
Contact:

Customised Cursor - not quite working :)

Post by WhytWulf »

My plan is to hide the default (windows) cursor, with

Code: Select all


device->getCursorControl()->setVisible(false);
and replace it with, my own cursor (once I draw the art for it), but the problem I'm having is not what I want to happen, but is useful at a later stage (don't you just love bugs, that actaully have a use ? :)

Code: Select all

//Load image for cursor
video::ITexture* cursorimage = driver->getTexture("../../media/irrlichtlogoaligned.jpg");
driver->makeColorKeyTexture(cursorimage, core::position2d<s32>(0,0));
....
//do rest of loading
.....
//attach cursorimage to mouse cursor position
core::position2d<s32> m = device->getCursorControl()->getPosition();
driver->draw2DImage(img, core::position2d<s32>(m.X,m.Y),rect<s32>(m.X-100,m.Y-100,m.X+100,m.Y+100));

driver->endScene();
What happens is the image/texture gets loaded as normal, but when I move the mouse it displays the image, but is it like the image is stuck to the background and when I move the mouse it appears to act like a window past the 3D environment and shows me the tiled image.

See the following images, sorry about the size..
Image

and me moving the cursor to new location
Image

Hopefully it makes sense :)
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Replace

rect<s32>(m.X-100,m.Y-100,m.X+100,m.Y+100)

with a constant rect like

rect<s32>(0,0,50,50),

this should work.
WhytWulf
Posts: 51
Joined: Mon Sep 08, 2003 11:14 am
Location: Australia, Tamworth, NSW
Contact:

Post by WhytWulf »

Thanks Niko, that fixed it up perfectly.. Just so you don't think I was silly with the large -100,-100,100,100 setting.. I did that just to make the problem more visible...
Post Reply