-1

I want to use windows raw input to enable two mice input on one computer.

However, I failed to figure out how to get the WM_INPUT message. It seems to get the message, I need to do this:

MainWndProc (HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
        switch (nMsg)
        {
               ...
              case WM_INPUT: 
                {
                        GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, 
                                                        sizeof(RAWINPUTHEADER));
               .............
        }
}

I think the OpenSceneGraph window should be a window's type,but how can I get the WM_INPUT message without using MainWndProc?

It seems I cannot get WM_INPUT message like this:

bool CallbackManager::handle(const GUIEventAdapter& ea, GUIActionAdapter& us)
{
        if(ea.getEventType() == WM_INPUT)

Then should I get the windows handle and how to?

lightrek
  • 951
  • 3
  • 14
  • 30

1 Answers1

1

OpenSceneGraph is a cross plattform toolkit. The Windows messages are translated internally in OpenSceneGraph and turned into OSG specific types. What you get in the CallbackManager is completely detached from the Windows messages.

Short of diving into the OpenSceneGraph code and adding the multiple pointer device support in OSG's core, there's little you can do about it.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • There is a [osgdirectinput](https://bitbucket.org/openscenegraph/osg/src/534a5d2d225d/examples/osgdirectinput/?at=default) example in OSG, not sure if it can be extended for two mice input? – lightrek Nov 21 '13 at 15:00
  • 1
    @lightrek: It should be easy enough, since with DirectInput each input device connected must be accessed individually anyway. You see that line 66? It uses the `SysMouse` alias. But you can enumerate mice just as you can enumerate joysticks. So you'd have to enumerate all mice, create device instances for all of them, query them in a loop and feet the accumulated events to OSG. – datenwolf Nov 21 '13 at 15:09