Page 1 of 2

Question about setMouseCursor

Posted: Thu Dec 02, 2010 03:41
by cCj
Hi i was using setMouseCursor to change cursor icon but wasnt able to change cursor to more than one image.

Code: Select all

// This works:
gameWin->setMouseCursor("cselect","test456");

// but not this:

if(something)
gameWin->setMouseCursor("cselect","test456");
else
gameWin->setMouseCursor("cselect","test123");




am i trying to use setMouseCursor properly?

thx!


Log part:

Code: Select all

02/12/2010 05:22:17 (Std)    ---- Version 0.7.4 (Build: Oct 11 2010 Microsoft Windows MSVC++ 10.0 32 bit) ----
02/12/2010 05:22:17 (Std)    ---- Renderer module is: CEGUI::OpenGLRenderer - Official OpenGL based 2nd generation renderer module.  TextureTarget support enabled via FBO extension. ----
02/12/2010 05:22:17 (Std)    ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
02/12/2010 05:22:17 (Std)    ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
02/12/2010 05:22:17 (Std)    ---- Scripting module is: None ----

Re: Question about setMouseCursor

Posted: Thu Dec 02, 2010 07:45
by rockoz
If you want to change mouse cursor in "gameWin" depending on "something" I think your code should work.

Re: Question about setMouseCursor

Posted: Fri Dec 03, 2010 01:48
by cCj
Thx..
i noticed the mouse icon changes only when you move mouse over some window.
am i missing some update call after setMouseCursor?

Re: Question about setMouseCursor

Posted: Fri Dec 03, 2010 07:58
by Kulik
If you want to change the global cursor, see CEGUI::System::setDefaultMouseCursor, Window::setMouseCursor sets the cursor that is only seen when mouse gets over that window.

Re: Question about setMouseCursor

Posted: Fri Dec 03, 2010 19:00
by cCj
Thx, i want to change the cursor only for the Root window and keep it default for all the actual windows.
Problem is setMouseCursor()
doesnt change it until you hover mouse over some window other than the root.

Re: Question about setMouseCursor

Posted: Fri Dec 03, 2010 20:30
by Jamarr
This sounds odd. In any case, have you tried invalidating the window? calling draw() on the cursor (force geometry redraw)? or perhaps even using System::notifydisplaysizechanged() to force refreshing the entire gui? Obviously you should not have to do this, but one of these may work as a temporary solution until it can be fixed in the CEGUI source.

Re: Question about setMouseCursor

Posted: Fri Dec 03, 2010 21:05
by Kulik
It's implemented to only react to mouse enters surface and mouse leaves surface events. It won't work for the child windows (their surface isn't parent's surface)! I suggest you use setDefaultCursor instead.

Re: Question about setMouseCursor

Posted: Fri Dec 03, 2010 21:52
by cCj
Jamarr wrote:This sounds odd. In any case, have you tried invalidating the window? calling draw() on the cursor (force geometry redraw)? or perhaps even using System::notifydisplaysizechanged() to force refreshing the entire gui?


Thx I tried those but it didnt work.

Re: Question about setMouseCursor

Posted: Fri Dec 03, 2010 21:54
by cCj
Kulik wrote:It's implemented to only react to mouse enters surface and mouse leaves surface events. It won't work for the child windows (their surface isn't parent's surface)! I suggest you use setDefaultCursor instead.


Thx i understand. put the problem is that if you change the cursor for the window the mouse is on, the cursor wont be updated until you move the cursor off from that window.

Re: Question about setMouseCursor

Posted: Fri Dec 03, 2010 21:57
by Jamarr
Unfortunately I do not have time to debug the issue myself, and thus derive a fix. But you might also try injecting the current mouse position, or manually firing the MouseEntersSurface event to perhaps force the update.

Re: Question about setMouseCursor

Posted: Fri Dec 03, 2010 22:34
by Kulik
The clean fix would be to alter setMouseCursor to check if mouse is over the surface and immediately switch the cursor if so.

Re: Question about setMouseCursor

Posted: Fri Dec 03, 2010 23:46
by cCj
Kulik wrote:The clean fix would be to alter setMouseCursor to check if mouse is over the surface and immediately switch the cursor if so.


Yep. Can someone post this to bug tracker?

Re: Question about setMouseCursor

Posted: Fri Dec 03, 2010 23:57
by Kulik
cCj wrote:
Kulik wrote:The clean fix would be to alter setMouseCursor to check if mouse is over the surface and immediately switch the cursor if so.


Yep. Can someone post this to bug tracker?


Go ahead, you officially have my seal of aproval :)

Re: Question about setMouseCursor

Posted: Sun Aug 07, 2011 21:08
by cCj
Ok I did and CE responded back, that it, is solved in 0-7 tag. But when I download 0.7.5 it wasnt fixed there... So do I need to download 0.7 ??

Re: Question about setMouseCursor

Posted: Sun Aug 07, 2011 21:33
by Kulik
Yeah, I think it isn't released yet. You can grab the mercurial sources and switch to v0-7 branch