Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: simluate mouse event!!!  (Read 1252 times)

lw89

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
simluate mouse event!!!
« on: January 31, 2010, 06:50:48 PM »

Hi everyone:
   I got a problem when doing my project that use ogre and wii. I want use wii to implement mouse enevt, at moment i can read button clicked form wii. but this only in the update loop. I want to convert  it as a mouse left button clicked.

  I think when read a button click from wii,  send a message to ois system. tell them this is a mouse event. is this right, anyone can give some suggestion.

thanks a lot   
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Re: simluate mouse event!!!
« Reply #1 on: February 01, 2010, 07:48:29 PM »

I'm not sure I'm following you. You are using OIS + a WiiMote and want the wiimote to act like a mouse to CEGUI?

If so, you can feed in Mouse values from WiiMote joystick events.
Logged

lw89

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Re: simluate mouse event!!!
« Reply #2 on: February 02, 2010, 04:00:31 AM »

yes, that is i want. can i you give me some detail about what do i need to do.

i can give wii button clicked in framestarted()

framestarted()
{
     if (remote.Button.A())
     {
      //i think i need do something here, here is i get button clicked from wii remote.
      //and i want to convert it as a mouse clicked. let it work on the CEGUI.   
      mMouse->mState.buttonDown( OIS::MB_Left);
      //do i need  call mousepressed() or do something , this is not worked.       
         
      }

}
« Last Edit: February 02, 2010, 04:11:49 AM by lw89 »
Logged

lw89

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Re: simluate mouse event!!!
« Reply #3 on: February 09, 2010, 08:23:29 AM »

what kind value should i feed in, can you give me more detail
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Re: simluate mouse event!!!
« Reply #4 on: February 10, 2010, 06:11:05 PM »

Are you using a custom Wiimote library? Or the OIS Wiimote example? In anycase, take your wiimote motion values and transform however you like directly into CEGUI. Like take a motion axis and use CEGUI's injectMouse function.
Logged

lw89

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Re: simluate mouse event!!!
« Reply #5 on: February 15, 2010, 12:00:31 PM »

Thanks a lot for replay my question, but i still get it worked. I just a new here, still have something didnt understand.

I have try this line code. I think this will try inject left button pressed. but this didnt work

    CEGUI::System::getSingleton().injectMouseButtonDown(convertOISMouseButtonToCegui(OIS::MouseButtonID::MB_Left));


At moment, i looking code about OIS, i try call mousepressed() this function. do you think this will worked.

        mMouse->listener->mousePressed(const OIS::MouseEvent::MouseEvent(), OIS::MouseButtonID::MB_Left);

is this line will call mousepressed() this function directly. and there has some error about  first parameter passed in. i think that is a mouse pressed event.

i stoped at this problem too long and i cant work with further if i cant fix this. please have a look my problem.  thank you very much
« Last Edit: February 15, 2010, 12:34:50 PM by lw89 »
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Re: simluate mouse event!!!
« Reply #6 on: March 06, 2010, 09:37:12 AM »

You shouldn't call the mouse listener like that. As for injecting Mouse Button Down, how do you know it didn't work? What did you want it to do? I'm pretty sure a click in CEGUi is mouse down followed by a mouse up.

I suggest posting some more code so I can better see what you're trying to accomplish, I'm still not 100% clear.
Logged

lw89

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Re: simluate mouse event!!!
« Reply #7 on: March 21, 2010, 06:08:56 PM »

my project is use Wii as a mouse to play the game.  I have get ir tracking worked. so at moment cursor can moved follow IR tracking data. and the next thing is get buttom work. The basic idea is i want use buttom A that on the wii remote worked as a mouse left buttom.  because i only can get wii buttom event in the update loop, so i create a function in the update loop. that is when wii buttom pressed call mouse left buttom directly.

i only has this few line code about this part.
Code: [Select]
bool GameListener::frameStarted(const FrameEvent &evt)
{
  if (remote.Button.A())//listen Wii buttom press
  {
      //this line try to conver it as a left button press
      CEGUI::System::getSingleton().injectMouseButtonDown(convertOISMouseButtonToCegui(OIS::MouseButtonID::MB_Left));


   }
    return true;
}

« Last Edit: March 21, 2010, 06:11:50 PM by lw89 »
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Re: simluate mouse event!!!
« Reply #8 on: March 21, 2010, 06:26:04 PM »

OK, so remote.Button.A() is a method from some other Wii library? If this is not working, I suppose you need a mouse up? This looks more like a CEGUI question than OIS. Perhaps you should post there.
Logged

lw89

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 6
    • View Profile
Re: simluate mouse event!!!
« Reply #9 on: March 22, 2010, 12:35:41 PM »

Thanks a lot for answer my question, i  totally going to a wrong way.  now i fix the problem, it's something about cegui.
Logged

JeDi

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 2
    • View Profile
Re: simluate mouse event!!!
« Reply #10 on: April 01, 2010, 06:17:48 AM »

I implemented a mouse and keyboard injector for OIS, which we use in our ActiveX environment for example (we get the mouse events, so it was easier to inject them into OIS in stead of patching OIS to cope with child windows). It works like a normal mouse or keyboard, only that you inject the events in stead of them being generated internally.

With this system, you can just use your normal listeners and they won't even notice that the events are injected externally.
I will create the patch and post it here if anyone is interested.

Greetz,
JeDi
Logged