Page 1 of 1

Root window clicks?

Posted: Sun Feb 21, 2010 18:56
by gamecoder4
Hi
how can i find out when the user clicks the very root window?

i was trying this:

Code: Select all

Window* main = dynamic_cast<Window*>(winMgr.getWindow("editor"));

main->subscribeEvent(Window::EventMouseMove, Event::Subscriber(editorMouseMove));

but the EventArgs holds wierd data so I thought this must not be used this way?

Version : 0.7.1

Re: Root window clicks?

Posted: Sun Feb 21, 2010 19:36
by CrazyEddie
Hi,

Code looks fine to me. So I have to ask, what do you mean by weird data in the EventArgs?

Btw, WindowManager::getWindow already returns a WIndow* so your cast there is somewhat superfluous ;)

CE.

Re: Root window clicks?

Posted: Sun Feb 21, 2010 19:48
by gamecoder4
hi CE

well i have function like this:

Code: Select all

bool editorMouseMove(const CEGUI::EventArgs& e)
{
 const MouseEventArgs &me = static_cast<const MouseEventArgs&>(e);

// me.button

if(me.sysKeys == 1) // left click
{
}

}


but me.button never has correct MouseButton::LeftButton etc but only NoButton.
and if(me.sysKeys == 1) // left click, seems to work but only like 95% the time.....

so am i supposed to go with me.sysKeys ? :)
i was just wondering if im using thing the right way...

Re: Root window clicks?

Posted: Sun Feb 21, 2010 20:08
by gamecoder4
oh i found this was needed :
if(me.sysKeys & SystemKey::LeftMouse) instead of: if(me.sysKeys == 1)

thx! solved now

Re: Root window clicks?

Posted: Mon Feb 22, 2010 08:31
by CrazyEddie
awesome :lol: