Re: [DirectPython] DirectPython with Pyogre
Status: Inactive
Brought to you by:
hsalo
From: Heikki S. <ho...@gm...> - 2006-06-21 14:54:23
|
> -----Original Message----- > From: dir...@li...=20 > [mailto:dir...@li...]=20 > On Behalf Of Jamison Prianos > Sent: 21. kes=E4kuuta 2006 8:37 > To: dir...@li... > Subject: [DirectPython] DirectPython with Pyogre >=20 > Hello all.. >=20 > I'm new to DirectPython, but it seems to be exactly what I=20 > want for input in my engine. I'm using Pyogre (python=20 > binding to the C OGRE rendering > libraries) for the graphics in the program and would like to=20 > figure out a way to use DirectPython for my Input and Audio. =20 > The problem I'm having is that I don't receive any messages=20 > on d3d.getMessages() when using Pyogre's window for d3d. >=20 > I'm initialising d3d with the following: > d3d.createDevice(u'', u'', 0, 0, False, CREATE.HARDWARE,=20 > self.graphics.hWnd) >=20 > My d3d.Media and d3d.Sound work just fine in this setup, but=20 > when I watch for .getMessages() I get nothing from the Pyogre=20 > window, no mouseMoves, no windowResizes, nada. >=20 > When I change the device to 'd3d.createDevice()' it creates a=20 > second window > (obviously) for DirectPython and I get all my messages=20 > spilling into the print log as intended. Is there something=20 > else I have to do in order to have DirectPython be able to=20 > intercept inputs to a foreign window? I know there are=20 > examples of uses in WxPython and some other frameworks that=20 > use a non-native window, but I don't see anything in there in=20 > regards to hooking the input from another framework. The=20 > Pyogre input handling leaves much to be desired, so any help=20 > in this would be greatly appreciated. >=20 > -Jamison Prianos >=20 I have't tried DP with PyOgre, but usually when you pass a window handle = to createDevice() it is best to use some other method than getMessages(). = Note that wx and winapi examples don't call getMessages() at all, they use = the message handling stuff provided by the library. When a message is sent = to a window it is placed on the message queue or sometimes posted directly to = the message handler. It is likely that PyOgre has it's own message handler = that handles and discards these messages before getMessages() has a chance to = get them. There is no simple way to prevent this. If you really want to get all messages you can try to hook the window. = There are some libraries that allow you to do that. By the way, if you don't use any DP rendering calls but only Media, = Sound and Input, you can also pass the window handle as the second = (undocumented, but don't worry as it's not going to change) argument to showWindow(SHOW.SHOW, self.graphics.hWnd). This doesn't create internal rendering objects and saves some resources. -- Heikki Salo |