Getting the HWND of the Pyogre window

Jamison

19-06-2006 08:07:15

I am working on merging DirectPython for my sound and input with Pyogre for my rendering and GUI. What I'm currently having trouble with is getting the HWND of the OGRE render window so that I can pass this as the focus window for the input watching. If there are any ideas it would be appreciated, as I'd really rather not find another input library.

-Jamison

dermont

19-06-2006 09:08:03

What version of pyOgre are you using?. Version 1.2.0 was updated to include retrieval of CustomAttributes from a RenderTarget. This was only really tested using an older version of OIS on windows but hopefully should work.


if sys.platform == 'win32':
hwnd = self.renderWindow.getIntCustomAttribute("HWND")
elif sys.platform.startswith('linux'):
hwnd = self.renderWindow.getIntCustomAttribute('GLXWINDOW')
else:
raise Exception, 'Platform not supported'
print "Window Handle Value is", hwnd

Jamison

19-06-2006 15:55:12

I'm currently using 1.0.5 Azathoth release. I'll download the latest version and see if the GetIntCustomAttribute call is in there, as this version only has GetCustomAttribute, which wants a c/c++ pointer as a second argument, so I don't know exactly how to extract the handle with it. Thanks for the help.

According to BerliOS, I have the most recent version of the pyogre binaries. Seeing as I have never compiled pyogre from source, does anyone know if there is a way to use the older call, getCustomAttribute, to get this information? Any help is much appreciated... or a link to a Dagon pyogre port.

-Jamison

dermont

19-06-2006 16:21:41

I believe Itstari has a windows build here:
http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=1413

Jamison

20-06-2006 05:31:05

Thanks for the fast responses, 1.2.0 and the getIntCustomAttribute worked great. Time to start porting from my PyOgre/PyGame hybrid to the new PyOgre/DirectPy setup.

-Jamison