ParaToxic Posted December 21, 2011 Posted December 21, 2011 Hey guys I would like to use CEGUI and made a layout with the help of the tutorial.But now I going to make userinput. Until now I injected the Mouseposition with MouseX,Y from LE. But how can I inject Mouseclicks ans Keyboard input??? A code sample would be nice ;D Thanks Quote
smashthewindow Posted December 21, 2011 Posted December 21, 2011 Hey guys I would like to use CEGUI and made a layout with the help of the tutorial.But now I going to make userinput. Until now I injected the Mouseposition with MouseX,Y from LE. But how can I inject Mouseclicks ans Keyboard input??? A code sample would be nice ;D Thanks http://www.cegui.org.uk/docs/current/input_tutorial.html Quote Blog & Portfolio Current project: moon.chase.star
ParaToxic Posted December 22, 2011 Author Posted December 22, 2011 Thanks I worte that: CEGUI::System::getSingleton().injectMousePosition(MouseX(), MouseY()); if(MouseHit(1)) { CEGUI::System::getSingleton().injectMouseButtonClick(CEGUI::MouseButton::LeftButton); } else if(MouseHit(2)) { CEGUI::System::getSingleton().injectMouseButtonClick(CEGUI::MouseButton::RightButton); } else { CEGUI::System::getSingleton().injectMouseButtonClick(CEGUI::MouseButton::NoButton); } But it doesn't work Why? Quote
smashthewindow Posted December 22, 2011 Posted December 22, 2011 Thanks I worte that: CEGUI::System::getSingleton().injectMousePosition(MouseX(), MouseY()); if(MouseHit(1)) { CEGUI::System::getSingleton().injectMouseButtonClick(CEGUI::MouseButton::LeftButton); } else if(MouseHit(2)) { CEGUI::System::getSingleton().injectMouseButtonClick(CEGUI::MouseButton::RightButton); } else { CEGUI::System::getSingleton().injectMouseButtonClick(CEGUI::MouseButton::NoButton); } But it doesn't work Why? MouseHit() returns true or false based on if Mouse was pressed since the last hit function was called. (From wiki, "Holding the tested button down does not return true, as it is only true if the button has been released and pressed again.".) You'll be injecting every frame, so I think you should use MouseDown(). Quote Blog & Portfolio Current project: moon.chase.star
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.