[slvd]are there any way to monitor the cursor state changing

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

Cloudage
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Thu May 28, 2009 11:37

[slvd]are there any way to monitor the cursor state changing

Postby Cloudage » Tue Nov 17, 2009 06:40

i hope there will be some events notices me what the cursor exactly is(arrow,sizing,textinputing,busy,etc) when it changed,whatever i use or not use the cegui cursor.

i`m currently working on my level editor,and for some reason i`d better let user use system cursor,so i need to change the system cursor to 'textinput' when user sopt on a editbox,or change it to 'sizing' when user spot on a sizeable FrameWindow`s border.

is there a simple and directly solution?
thanks for any help.
Last edited by Cloudage on Tue Nov 17, 2009 10:05, edited 1 time in total.

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Re: are there any way to monitor the cursor state changing?

Postby scriptkid » Tue Nov 17, 2009 09:35

Hi,

The mousecursor has an 'EventImageChanged' event, which is fired when the cursor changes. So you could intercept it to handle your own cursor appearance. You will receive a 'MouseCursorEventArgs' argument type containing the cursor and its current image (CEGUI::Image). This makes me think that it does not actually have a state. So you should interpret the different images yourself.

I don't have all code at hands, but your should probably listen to it with this code:

Code: Select all

MouseCursor::getSingleton().subscribeEvent(MouseCursor::EventImageChanged, Event::Subscriber(&YourApp::YourHandler, this));


Note that in order for this to work, your Cegui windows need to be 'alive'. Meaning that you should pass mouse events (which you receive in your editor application) into Cegui aswell.

Also, the internal behaviour changes the cursor image, so you might end up with two cursors. I think that you can overwrite this by resetting the cursor image to Null from your event handler. But i am not sure about this behaviour.

Anyway, good luck :)
Check out my released snake game using Cegui!

Cloudage
Not too shy to talk
Not too shy to talk
Posts: 27
Joined: Thu May 28, 2009 11:37

Re: are there any way to monitor the cursor state changing?

Postby Cloudage » Tue Nov 17, 2009 10:04

thank you scriptkid, i got it.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 8 guests