Page 1 of 1

[SOLVED]Mouse handling in Windows OS

Posted: Sun Jul 03, 2011 14:28
by Rampage
Hallo, i have a problem with handling mouse inputs in CEGUI. Simply, i cant find any working code.

I tried something, but it doesnt works, heres my code. It seems, i need to covert absolute cursor position to relative. Can you plese help me how to correctly handle mouse input?

Code: Select all

switch(message)
      {
      case WM_MOUSEMOVE:
         {
            bool test = CEGUI::System::getSingleton().injectMouseMove((float)LOWORD(lParam),(float)HIWORD(lParam));
            if(!test)
               CEGUI::MouseCursor::getSingleton().setImage("TaharezLook", "MouseArrow");
         }
         break;
      case WM_LBUTTONDOWN:
         {
            CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);
         }
         break;
      case WM_LBUTTONUP:
         {
            CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);
         }
}


EDIT: I found CEGUI api function, that uses exact coordinates. So you just need to use it and everyhing is working correctly

Re: Mouse handling in Windows OS

Posted: Mon Jul 04, 2011 16:11
by Kulik
I am not familiar with WinAPI and would have to look up the details to be sure.

However CEGUI allows 2 mouse injects. One is relative (which is what you are using - injectMouseMove) and the other is absolute (injectMousePosition). I suggest you give the absolute inject a try.