About Store Forum Documentation Contact



Post Reply 
windowLit() Removed
Author Message
fatcoder Offline
Member

Post: #1
windowLit() Removed
I used to use windowLit() to determine if the mouse was over any gui window. I didn't care which window, I just want to know if it is point at any window at all. This way I can prevent user input in the scene while the cursor is over a window. Now that windowLit() has been removed (back in September 2011), I had to find an alternative way to achieve this. So I have started doing this now instead.

Code:
if(Gui.msLit() && Gui.msLit()->type() != GO_DESKTOP)
{
   // The mouse is over a gui object, so we cannot process input in the scene.
}
else
{
   // The mouse is not over any gui object so input can be processed in the scene.
}

This seems to work ok, but it is just long winded in comparison to the old method of doing this. Is this the correct way to handle this situation now or is there a better way?
On a side note. I was hoping to use Ms.eat() to eat all mouse buton input when the mouse is over a gui object, so that it doesn't pass down to the scene. I don't want mouse buttons clicks to register in the scene when the user clicks a button in the gui. However it doesn't seem to work this way. Here is what I'd like to do in the app update method every frame (pseudo-code).

Code:
Game::World.update( Cam.at );

Cam.set();

if( mouse over gui )
   Ms.eat();

// Update the scene... if the mouse was over a gui object this frame, then the mouse input has been eaten so it can't affect the scene.
scene.update();

This approach doesn't work as it causes the input to be eaten for the gui as well. I'm guessing under the bonnet that EE calls the app's update() method before calling the gui's update methods internally. Is there some way around this or a known way to block input in the scene when the mouse is over a gui window that I haven't found yet.
(This post was last modified: 02-26-2012 02:20 AM by fatcoder.)
02-26-2012 02:09 AM
Find all posts by this user Quote this message in a reply
Rabishan Offline
Member

Post: #2
RE: windowLit() Removed
instead of using Ms.eat() why don't you try something like
if(!mouse over gui) player move.
02-26-2012 08:03 AM
Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #3
RE: windowLit() Removed
Thanks for the suggestion and that is what I have been doing. That works ok for simple scenes where the only input the user is to move their character. However in complex scenes where the user can interact with the scene in many ways (like I have), it becomes a bit of a headache to use these checks everywhere. I'm hoping for an easy way to just cancel out all input after the gui has finished with it.
02-26-2012 08:28 AM
Find all posts by this user Quote this message in a reply
Post Reply