PyOIS in non-exclusive mode?

BernieRoehl

04-09-2006 23:16:40

I realize that PyOIS may be a bit off-topic for this forum, but since it's being maintained alongside the PyOgre bindings, I figured I would ask here.

I'm trying to use the mouse in non-exclusive mode. According to the OIS docs, this should be easy to do, but for some reason PyOIS is throwing an exception.

I've stripped down the code to the following example:


iimport sys
import pyogre.ogre
import ois

root = pyogre.ogre.Root("plugins.cfg")
root.restoreConfig()
renderWindow = root.initialise(True)

hwnd = renderWindow.getIntCustomAttribute("HWND")

oisParams = {
"WINDOW": str(hwnd),
"w32_mouse" : "DISCL_NONEXCLUSIVE",
"w32_mouse" : "DISCL_FOREGROUND"
}

inputManager = ois.InputManager.createInputSystem(oisParams)
mouse = inputManager.createInputObject(ois.OISMouse, True)


When I run it, I get the following:

Traceback (most recent call last):
File "C:\Documents and Settings\Bernie\Desktop\Haven\test.py", line 18, in ?
mouse = inputManager.createInputObject(ois.OISMouse, True)
File "C:\Documents and Settings\Bernie\Desktop\Haven\ois.py", line 1064, in createInputObject
return _ois.InputManager_createInputObject(*args)
ois.Exception: Win32Mouse::Win32Mouse >> Failed to set coop level


Before I go digging around in the OIS code, I thought I would ask here and see if anyone else has encountered this.

Thanks in advance for any help!

BernieRoehl

04-09-2006 23:54:00

Never mind... I found the examples, and they show...

oisParams = {
"WINDOW": str(hwnd),
"w32_mouse" : ["DISCL_NONEXCLUSIVE", "DISCL_FOREGROUND"]
}


... which works great.

Sorry for the waste of bandwidth.