Alternate Input System

Istari

11-12-2005 19:47:39

I'm working on a Python wrapper for OIS http://sourceforge.net/projects/wgois
I have a working prototype and I would love to get your feedback on it.
It has a drop-in replacement for SampleFramework.py and seems to work just fine.

Here is a Python23 module, if you need a Python24 module you will have to build it yourself from the oisaddons/python CVS module at the above mentioned URL.
http://ares.hlekkir.com/stuff/PyOis.zip

Clay

11-12-2005 22:54:21

That's really nice. After working with the ogre event system I'm about fed up with dealing with it. Do you mind if I include your SampleFramework (with modifications) in pyogre?

Does this system allow for event callbacks? Such as something.onKeyDown(...)?

Istari

11-12-2005 23:14:18

Of course, you are welcome to include it.
There is a callback system that I implemented after reading a post here by you. There is essentially one class that handles the delegation of events to registered Python functions. No directors.
Here is a small sample:
import ois
import time

def onMouseMoved(arg):
print 'Mouse X: %d' % arg.state.absX
print 'Mouse Y: %d' % arg.state.absY
return True

def onMousePressed(arg, id):
print 'Mouse pressed: %d' % id
return True

# A window handle must be aquired, but is skipped for this demonstration

inputSystem = ois.InputManager.createInputSystem(params)
mouse = inputSystem.createInputObject(ois.OISMouse, True)
mouse.enableEvents()

ois.getEventListener().addListener('mouseMoved', onMouseMoved)
ois.getEventListener().addListener('mousePressed', onMousePressed)

while True:
mouse.capture()
time.sleep(0.1)


You should look at wxTest.py to see how it works.

Also I had to create an int* wrapper to be able to call RenderWindow.getCustomAttribute
hadle = ois.IntPtr()
self.renderWindow.getCustomAttribute("HWND", handle)
hwnd = handle.value()

Clay

11-12-2005 23:52:22

I didn't notice the getCustomAttribute in RenderTarget. I'll add this to my todo list.

dermont

12-06-2006 22:09:17

What's the current status of the pyOIOS bindings. It appears that the wrappers for pyOIS won't compile with OIS0.70 and there's some confusion on it's status:
http://www.wreckedgames.com/forum/viewtopic.php?t=66

Istari

12-06-2006 22:58:51

I haven't had a chance to look at it in some time, but I have been planning to update it and integrate it better with PyOgre.

dermont

13-06-2006 09:27:57

OK thanks for the feedback.