directpython-general Mailing List for DirectPython
Status: Inactive
Brought to you by:
hsalo
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
(3) |
Jun
(2) |
Jul
(5) |
Aug
(3) |
Sep
|
Oct
(2) |
Nov
|
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(2) |
Feb
(7) |
Mar
|
Apr
(2) |
May
|
Jun
(1) |
Jul
(5) |
Aug
(11) |
Sep
|
Oct
(3) |
Nov
(7) |
Dec
(5) |
2008 |
Jan
(4) |
Feb
|
Mar
|
Apr
(1) |
May
(3) |
Jun
|
Jul
(2) |
Aug
(1) |
Sep
(2) |
Oct
|
Nov
(4) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Gudmundur G. <the...@ho...> - 2011-06-11 09:19:29
|
http://co-p.com/indexz53X.php |
From: Gudmundur G. <the...@ho...> - 2011-06-09 18:05:53
|
http://www.h-ec.ae/indexz51X.php |
From: Simon P. <sip...@go...> - 2009-06-09 13:01:22
|
Hi, I've posted a few questions on this list lately without response. Is it still active? Is there anybody there? :) Simon |
From: Simon P. <sip...@ho...> - 2009-06-08 12:57:02
|
Hi, Is it possible to use d3d.getDevice() to pass the created IDirect3DDevice9 to a c++ function? Using boost::python, I have an extension module function with this signature: // c++ void TestClass::Init( IDirect3DDevice9* device ); I am trying to call this function with: #python, called after device is created: from testClass import TestClass test = TestClass() test.Init( d3d.getDevice() ) Here's the error I get: ################## Traceback (most recent call last): File "client.py", line 31, in __init__ test.Init(d3d.getDevice()) Boost.Python.ArgumentError: Python argument types in TestClass.Init(TestClass, long) did not match C++ signature: Init(class TestClass {lvalue}, struct IDirect3DDevice9 *) ################## See how I have a type mismatch? How come d3d.getDevice() returns a long? Do I need to use COM to get this sort of functionality? Ie, get a device to pass to c++? Thanks Simon |
From: Simon P. <sip...@ho...> - 2009-06-06 14:06:50
|
Hello DirectPythonistas! As an experienced c++, python and dx programming, I'm really enjoying DirectPython so far.... Here's my first question: How can I specify the image file to use for the GUI widgets? Also, I am not sure having the paths to textures/icons etc in the source code is a good idea, I'd rather specify them in a project .py file. Thanks Simon |
From: Korg K. <mr....@se...> - 2009-05-04 09:07:57
|
hello i have a problem with all the samples that are using animated meshes they make python crash when i run samples from dos window it says that mesh does not hava animations or parse error! and some more api for armatures could be usefull like moving rotating and scaling or modifiing their matrix for bones... |
From: Heikki S. <ho...@gm...> - 2008-11-30 15:53:08
|
2008/11/27 Aleksandar Kordic <ale...@gm...>: > Hi, > > My project is simple simulation of robot movement on rectangular > board. I used Frame from d3dx and StaticMesh from d3d module. So far > only one model is presented in scene. > Problem is that textures from .x file are not shown in scene. Am I > doing something wrong in onRender() method ? > > def onRender(self): > d3d.setView(self.eye, self.lookat, 6000.0, 0.7853) > d3d.setState(RS.LIGHTING, True) > d3d.setState(RS.AMBIENT, 0xffffffff) > d3d.setState(RS.SPECULARENABLE, True) > > d3d.setLight(0, LIGHT.DIRECTIONAL, 0xffffffff, 500.0, (0.0, 100.0, > 0.0), (0.3, -1.0, 0.3), 0.4, 0.4) > d3d.setLight(1, LIGHT.DIRECTIONAL, 0xffffffff, 500.0, (200.0, > -300.0, 0.0), (0.5, 0.5, 0.1), 0.4, 0.4) > d3d.setState(RS.FILLMODE, RS.FILL.SOLID) > > d3d.setTransform( element.translation, element.rotation, element.scaling ) > d3d.setState(RS.USEMESHMATERIALS, True) > element.mesh.render() #time_passed) - not for static mesh > > d3d.setState(RS.FILLMODE, RS.FILL.SOLID) > self.manager.render(self.elapsedtime) > > Strange thing is that same model opened with 'MeshViewer.py' sample > does not show textures, while DXViewer.exe (from directx sdk) loads > textures properly. > > Textures in .x file are referenced as files > example : > Material Wood_OSB1{ > 0.392156862745098;1.0;0.392156862745098;1.0;; > 3.2; > 0.000000;0.000000;0.000000;; > 0.000000;0.000000;0.000000;; > TextureFilename { "teren.xWood_OSB.jpg"; } > } > > Is it possible that d3d.StaticMesh does not load properly from '.x' > file ? If so how can I contribute to fix this ? > > Best Regards, > Alex > As you noticed, StaticMesh does not load any textures. Internally the mesh object uses basic D3DX-functions and interfaces which don't support it. The more complex interfaces (ID3DXFile etc.) require much more processing which is not usually needed. Actually, it is almost easier to write a simple .x-parser in Python than to create fully supported C++-loader with those interfaces. They are flexible, but also quite complex. It is quite common to use .x-files to only store geometry (etc.) data and use some other file format to store other information. For example a simple text file could specify information about an object, like it's physical abilities textures and approriate .x-files (if it is a composite shape or something). When you need to load an object you just process this file and load all needed resources. -- Heikki Salo |
From: Aleksandar K. <ale...@gm...> - 2008-11-27 18:55:30
|
Hi, My project is simple simulation of robot movement on rectangular board. I used Frame from d3dx and StaticMesh from d3d module. So far only one model is presented in scene. Problem is that textures from .x file are not shown in scene. Am I doing something wrong in onRender() method ? def onRender(self): d3d.setView(self.eye, self.lookat, 6000.0, 0.7853) d3d.setState(RS.LIGHTING, True) d3d.setState(RS.AMBIENT, 0xffffffff) d3d.setState(RS.SPECULARENABLE, True) d3d.setLight(0, LIGHT.DIRECTIONAL, 0xffffffff, 500.0, (0.0, 100.0, 0.0), (0.3, -1.0, 0.3), 0.4, 0.4) d3d.setLight(1, LIGHT.DIRECTIONAL, 0xffffffff, 500.0, (200.0, -300.0, 0.0), (0.5, 0.5, 0.1), 0.4, 0.4) d3d.setState(RS.FILLMODE, RS.FILL.SOLID) d3d.setTransform( element.translation, element.rotation, element.scaling ) d3d.setState(RS.USEMESHMATERIALS, True) element.mesh.render() #time_passed) - not for static mesh d3d.setState(RS.FILLMODE, RS.FILL.SOLID) self.manager.render(self.elapsedtime) Strange thing is that same model opened with 'MeshViewer.py' sample does not show textures, while DXViewer.exe (from directx sdk) loads textures properly. Textures in .x file are referenced as files example : Material Wood_OSB1{ 0.392156862745098;1.0;0.392156862745098;1.0;; 3.2; 0.000000;0.000000;0.000000;; 0.000000;0.000000;0.000000;; TextureFilename { "teren.xWood_OSB.jpg"; } } Is it possible that d3d.StaticMesh does not load properly from '.x' file ? If so how can I contribute to fix this ? Best Regards, Alex |
From: Heikki S. <ho...@gm...> - 2008-11-24 18:06:46
|
2008/11/18 Caleb Crome <Cal...@lo...>: > Hello, > I'm working on an application that uses a logitech force feedback steering > wheel. I'm totally new to directpython, so sorry if this is a silly > question. > I was able to get information from the wheel, but I don't see any function > calls to set Force Feedback parameters from the GameController object. > My code so far is simple enough (below). How do I set forces and springs? > Thanks so much, > -Caleb > > #!/c/Python25/python25.exe > import d3d > import d3dx > from d3dc import * > class Turntable(d3dx.Frame): > def onCreate(self): > print "Creating..." > self.joystick = d3dx.GameController(1) > print self.joystick.hasForceFeedback() > return > def onUpdate(self): > pass > frame = Turntable(u"Turntable"); > frame.mainloop() > Unfortunately DirectPython does not support force feedback. Currently you need to interact directly with DirectInput or maybe use some other library to do force feedback. The C/C++-interface is exposed through IDirectInputEffect and .dll's, so it is possible to use it through comtypes, alotough that is not trivial. DirectInput API itself is no longer updated by Microsoft (altough it still works well and is widely supported) so I never really saw much need to add support and testing for it. -- Heikki Salo |
From: Caleb C. <Cal...@lo...> - 2008-11-18 00:17:18
|
Hello, I'm working on an application that uses a logitech force feedback steering wheel. I'm totally new to directpython, so sorry if this is a silly question. I was able to get information from the wheel, but I don't see any function calls to set Force Feedback parameters from the GameController object. My code so far is simple enough (below). How do I set forces and springs? Thanks so much, -Caleb #!/c/Python25/python25.exe import d3d import d3dx from d3dc import * class Turntable(d3dx.Frame): def onCreate(self): print "Creating..." self.joystick = d3dx.GameController(1) print self.joystick.hasForceFeedback() return def onUpdate(self): pass frame = Turntable(u"Turntable"); frame.mainloop() |
From: Heikki S. <ho...@gm...> - 2008-07-18 19:51:09
|
2008/7/16 Gudmundur Gunnarsson <the...@ho...>: > Hi > > I'm new to DirectPython and have been testing it for the last few days. I'm > running into problems with d3d.setTransform where the rotation of a model > around the axises is not happening in the order that I want. Looks like it's > XZY or ZXY but I want YZX or YXZ, putting the Y-axis rotation first. Each > setTransform overwrites the last one so I can't stack them up. Is there a > way to change the order or circumvent this somehow? > > Also, I wanted roll the eye/camera but couldn't find out how to do it. I can > put it somewhere and aim it somewhere but I can't seem to manipulate an > up-vector or roll it somehow. Is there a way to do this? > > Thanks! > You should be able to combine matrix operations by using the d3d.Matrix-class and then feeding the final result to the d3d.setMatrix()-function. Basically d3d.setTransform() is just a quick shortcut for these operations. The same also applies to the camera. d3d.setView() does some matrix operations and creates the view- and projection matrices. You can create these two matrices manually and the set them using d3d.setMatrix(). However, this might be little tricky if you are not familiar with matrices as the C-support functions are not currently exposed. You could use ctypes and call D3DXMatrixPerspectiveFovLH() and friends from the DirectX support .dll, but it is not a very good solution. Some of these matrix functions will be added for the next version, which should be (hopefully) released during this summer. -- Heikki Salo |
From: Gudmundur G. <the...@ho...> - 2008-07-15 23:54:38
|
Hi I'm new to DirectPython and have been testing it for the last few days. I'm running into problems with d3d.setTransform where the rotation of a model around the axises is not happening in the order that I want. Looks like it's XZY or ZXY but I want YZX or YXZ, putting the Y-axis rotation first. Each setTransform overwrites the last one so I can't stack them up. Is there a way to change the order or circumvent this somehow? Also, I wanted roll the eye/camera but couldn't find out how to do it. I can put it somewhere and aim it somewhere but I can't seem to manipulate an up-vector or roll it somehow. Is there a way to do this? Thanks! _________________________________________________________________ Invite your Facebook friends to chat on Messenger http://clk.atdmt.com/UKM/go/101719649/direct/01/ |
From: Frankovskyy B. <bfr...@gm...> - 2008-05-28 13:39:14
|
Hi, How I can transform a Vertices? I was trying to *drawVertices + **setTransform in samplewx.py but no luck :( A little example will help me. Thanks. * |
From: Heikki S. <ho...@gm...> - 2008-05-14 12:56:48
|
On 5/13/08, Mikhail Arefiev <m.a...@gm...> wrote: > Hello! I have a few d3d.Media instances (videos) in my little program > and they are to be rendered into a texture sequentially, and it works > fine until I try to resize the window. In this case, all Media > objects start to play simultaneously and it freezes everything. In > MEDIA.WINDOW mode, however, they don't, but getScreenshot() is > painfully slow (it should be, if I understand correctly). > > Is it possible to avoid such behavior? > > Is it possible to render videos into a window using MEDIA.WINDOW mode > and then draw some overlay (sprites and text) over them? > > Thanks in advance! > Hi, d3d.Media and its render-to-texture mode is currently quite fragile and experimental. The coordination between DirectShow, drivers, codecs and applications can be quite complex and error prone. There are some known issues with the object, especially some codecs don't support certain features correctly. For example when you resize the DirectPython window, the internal D3D device which is used to render the videos is reset. This also requires reloading the video and setting it's position, but things can go wrong just like you described. There are also some bugs in DirectPython side which can affect this. You could try to track the videos and their state manually, and when the window is resized set the state (is it running, postition etc) yourself. If you use the WINDOW-mode with a video, you should not be drawing anything else as the DirectShow updates the window and can mess up your your present() calls. Getting a screenshot of the video in this mode is slow (by design) as you noticed, so using this method with your scene graphics is not very solid. There are other ways to get data from video using DirectShow and VMR9, but most of them are not very solid (SampleGrabber-way could be one, but I havent implemented it). Hopefully most of the issues should be fixed for DirectPython 1.0, but the VMR9 renderless mode is quite tricky to get right in all configurations. So I am afraid you have to wait until the next realease. Fortunately I will have some spare time during the summer, so it should not take that long (month or slightly more). -- Heikki Salo |
From: Mikhail A. <m.a...@gm...> - 2008-05-13 08:11:24
|
Hello! I have a few d3d.Media instances (videos) in my little program and they are to be rendered into a texture sequentially, and it works fine until I try to resize the window. In this case, all Media objects start to play simultaneously and it freezes everything. In MEDIA.WINDOW mode, however, they don't, but getScreenshot() is painfully slow (it should be, if I understand correctly). Is it possible to avoid such behavior? Is it possible to render videos into a window using MEDIA.WINDOW mode and then draw some overlay (sprites and text) over them? Thanks in advance! |
From: Sebastian L. <del...@gm...> - 2008-04-30 03:31:33
|
Hi, I don't know if I'm wrong, but remember that you're running DirectPython (which is an extension for python) and you haven't any 3D accelerator. The SDK examples are written in lenguages such as C/C++, C# and other (die! VB! die!) who were planned to run multimedia applications. Maybe you can use psyco to optimize DP. BTW, with my GeForce XFX 7300 I didn't have any problems running the examples from DP. Regards, On Sun, Jan 20, 2008 at 5:52 PM, Heikki Salo <ho...@gm...> wrote: > > > ------------------------------ > *From:* dir...@li... [mailto: > dir...@li...] *On Behalf Of * > Question > *Sent:* 19. tammikuuta 2008 4:55 > *To:* dir...@li... > *Subject:* Re: [DirectPython] No HW acceleration supports? > > Samples for the DirectX SDK works fine on my computer, while DirectPython > runs very slow (actually slide show). > I don't know what's the problem. > > > > It is difficult to say what is wrong without additional information, but I > can try to make some educated guesses. You could try to force software by > adding "d3dx.Frame.deviceoverride = CREATE.SOFTWARE" to samples before the > device is created. The driver might be trying to emulate some states or > choke on non-supported ones, which kills performance. You could also check > the DirectX diagnostics tool and see if it reports anything odd. Running > some other Direct3D 9.0c applications for reference might help to figure out > what is wrong. And update drivers, if possible. > > -- > Heikki Salo > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > directpython-general mailing list > dir...@li... > https://lists.sourceforge.net/lists/listinfo/directpython-general > > -- █║▌│█│║▌║││█║▌│║ Sebastian Javier Lucas Programmer & Guitar Hero working@: gameloft |
From: Heikki S. <ho...@gm...> - 2008-01-20 20:52:57
|
_____ From: dir...@li... [mailto:dir...@li...] On Behalf Of Question Sent: 19. tammikuuta 2008 4:55 To: dir...@li... Subject: Re: [DirectPython] No HW acceleration supports? Samples for the DirectX SDK works fine on my computer, while DirectPython runs very slow (actually slide show). I don't know what's the problem. It is difficult to say what is wrong without additional information, but I can try to make some educated guesses. You could try to force software by adding "d3dx.Frame.deviceoverride = CREATE.SOFTWARE" to samples before the device is created. The driver might be trying to emulate some states or choke on non-supported ones, which kills performance. You could also check the DirectX diagnostics tool and see if it reports anything odd. Running some other Direct3D 9.0c applications for reference might help to figure out what is wrong. And update drivers, if possible. -- Heikki Salo |
From: Question <wan...@gm...> - 2008-01-19 02:55:02
|
Samples for the DirectX SDK works fine on my computer, while DirectPython runs very slow (actually slide show). I don't know what's the problem. On Jan 18, 2008 10:57 PM, Heikki Salo <ho...@gm...> wrote: > > > ------------------------------ > *From:* dir...@li... [mailto: > dir...@li...] *On Behalf Of * > Question > *Sent:* 16. tammikuuta 2008 7:44 > *To:* dir...@li... > *Subject:* [DirectPython] No HW acceleration supports? > > Hi, > > I'm using Intel 82945G Express Chipset, and It's said to be DX9 > supported. And I have not problem to run those samples in the DirectX SDK, > so I think HW acceleration is just not turned on here. > Anyone can help me? > Thanks! > > -- > >: ~ > > > Hi, > > I am not really sure what you are asking. Intel 82945G seem to use > 945-chipset, which does not support harware transform & lightning. With > these cards it is often best to ask explicitly for software rendering so you > can use vertex shaders. Otherwise you get "hardware" rendering, which can be > worse than true software. > > -- > Heikki Salo > -- >: ~ |
From: Heikki S. <ho...@gm...> - 2008-01-18 14:57:17
|
_____ From: dir...@li... [mailto:dir...@li...] On Behalf Of Question Sent: 16. tammikuuta 2008 7:44 To: dir...@li... Subject: [DirectPython] No HW acceleration supports? Hi, I'm using Intel 82945G Express Chipset, and It's said to be DX9 supported. And I have not problem to run those samples in the DirectX SDK, so I think HW acceleration is just not turned on here. Anyone can help me? Thanks! -- >: ~ Hi, I am not really sure what you are asking. Intel 82945G seem to use 945-chipset, which does not support harware transform & lightning. With these cards it is often best to ask explicitly for software rendering so you can use vertex shaders. Otherwise you get "hardware" rendering, which can be worse than true software. -- Heikki Salo |
From: Question <wan...@gm...> - 2008-01-16 05:44:06
|
Hi, I'm using Intel 82945G Express Chipset, and It's said to be DX9 supported. And I have not problem to run those samples in the DirectX SDK, so I think HW acceleration is just not turned on here. Anyone can help me? Thanks! -- >: ~ |
From: Heikki S. <ho...@gm...> - 2007-12-27 19:49:54
|
_____ From: dir...@li... [mailto:dir...@li...] On Behalf Of ?? Sent: 25. joulukuuta 2007 13:44 To: dir...@li... Subject: [DirectPython] sampleTk.py Dear Sirs, Modified program of tk.py is attached. It works on my notePC. BR, sugi Great work. I always tought that it was somethings simple. The solution was easy when I saw your code: width and height for d3d.createDevice() must not be zero. wxPython sample behaves little differently (zero arguments are correctly fixed), so the issue was not that obvious, especially when it was buried deep in C++ code. But it works now. -- Heikki Salo |
From: <su...@li...> - 2007-12-25 11:44:24
|
IyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioNCiMgICBz YW1wbGVUay5weQ0KIw0KIyAgIFRyaWVzIHRvIHNob3cgaG93IHRvIHVzZSBEaXJlY3RQeXRob24g d2l0aCBUa2ludGVyLg0KIw0KIyAgIE5PVCBXT1JLSU5HISBNYXliZSBpdCBpcyBzb21ldGhpbmcg cmVhbGx5DQojICAgc2ltcGxlLCBidXQgSSBkb250IHVuZGVyc3RhbmQgd2h5IHRoZQ0KIyAgIHRy aWFuZ2xlIGRvZXMgbm90IGFwcGVhci4gSWYgeW91IG1hbmFnZQ0KIyAgIHRvIG1ha2UgdGhpcyB3 b3JrIEkgd291bGQgbGlrZSB0bw0KIyAgIGtub3cgYWJvdXQgaXQuIA0KIw0KIyAgICAgIEF1dGhv cjogIEhlaWtraSBTYWxvDQojICAgICBDcmVhdGVkOiAgNy4yLjIwMDYNCiMgICAgIFVwZGF0ZWQ6 ICAxOS4yLjIwMDYNCiMNCiMqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqDQoNCmZyb20gVGtpbnRlciBpbXBvcnQgKg0KaW1wb3J0IGQzZA0KZnJvbSBkM2Rj IGltcG9ydCAqDQoNCiNTaW1wbGUgcHJlLXRyYW5zZm9ybWVkIHRyaWFuZ2xlLg0KdHJpYW5nbGUg PSAoDQogICAgKDEwLjAsIDQwMC4wLCAwLjUsIDEuMCwgMHhmZmZmZmYwMCksDQogICAgKDE5MC4w LCAxMC4wLCAwLjUsIDEuMCwgMHhmZmZmMDBmZiksDQogICAgKDM3MC4wLCA0MDAuMCwgMC41LCAx LjAsIDB4ZmYwMGZmMDApLA0KKQ0KDQpkZWYgZHVtbXkoKmFyZ3MpOg0KICAgIHBhc3MNCg0KY2xh c3MgQXBwbGljYXRpb24oRnJhbWUpOg0KDQogICAgZGVmIHBvbGwoc2VsZik6DQogICAgICAgIGQz ZC5wcmVzZW50KCkNCiAgICAgICAgc2VsZi5hZnRlcigxMDAwLCBzZWxmLnBvbGwpDQogICAgICAg IA0KICAgIGRlZiBjcmVhdGVXaWRnZXRzKHNlbGYpOg0KIyAgICAgICAgc2VsZi50b3BsZXZlbCA9 IFRrKCk7DQogICAgICAgIHNlbGYuY2FudmFzID0gQ2FudmFzKHNlbGYsIHdpZHRoPTMwMCwgaGVp Z2h0PTMwMCkNCiAgICAgICAgI3NlbGYuY2FudmFzWyJiZyJdID0gInJlZCINCiAgICAgICAgc2Vs Zi5jYW52YXMucGFjaygpDQogICAgICAgIHNlbGYuY2FudmFzLnVpX2hhbmRsZV9yZXBhaXIgPSBk dW1teQ0KIA0KICAgICAgICBkM2QuY3JlYXRlRGV2aWNlKHUiIiwgdSIiLCA0MDAsIDQwMCwgRmFs c2UsIENSRUFURS5TT0ZUV0FSRSB8IENSRUFURS5TV0FQQ09QWSwgc2VsZi5jYW52YXMud2luZm9f aWQoKSkNCg0KICAgICAgICBzZWxmLnRleHR1cmUgPSBkM2QuVGV4dHVyZSgibW9vbi5wbmciKQ0K ICAgICAgICB3ZCwgaHQsIGZvcm0gPSBzZWxmLnRleHR1cmUuaW5mbygpDQogICAgICAgIHByaW50 ICIod2QsaHQsIGZvcm0pPSIsIHdkLCBodCwgZm9ybQ0KDQogICAgICAgIGQzZC5jbGVhcigweGZm ZmYwMCkNCiAgICAgICAgZDNkLmJlZ2luU2NlbmUoKQ0KICAgICAgICBkM2Quc2V0U3RhdGUoUlMu RlZGLCBGVkYuWFlaUkhXIHwgRlZGLkRJRkZVU0UpDQogICAgICAgIGQzZC5kcmF3VmVydGljZXMo VFlQRS5UUklBTkdMRUxJU1QsIHRyaWFuZ2xlKQ0KICAgICAgICBkM2QuZHJhd1Nwcml0ZXMoc2Vs Zi50ZXh0dXJlLCBbKDAsMCldKQ0KICAgICAgICBkM2QuZW5kU2NlbmUoKQ0KICAgICAgICBkM2Qu cHJlc2VudCgpDQoNCiAgICAgICAgc2VsZi5wb2xsKCkNCiAgICAgICAgDQogICAgZGVmIF9faW5p dF9fKHNlbGYsIG1hc3Rlcj1Ob25lKToNCiAgICAgICAgRnJhbWUuX19pbml0X18oc2VsZiwgbWFz dGVyLCB3aWR0aD0yMDAsIGhlaWdodD0xMDAsIGJnPSJncmVlbiIpDQogICAgICAgIHNlbGYucGFj aygpDQogICAgICAgIHNlbGYuY3JlYXRlV2lkZ2V0cygpDQoNCmlmIF9fbmFtZV9fID09ICJfX21h aW5fXyI6DQogICAgYXBwID0gQXBwbGljYXRpb24oKQ0KICAgIGFwcC5tYWlubG9vcCgpDQoNCg== |
From: Heikki S. <ho...@gm...> - 2007-12-20 14:24:55
|
_____ From: dir...@li... [mailto:dir...@li...] On Behalf Of Alec Bennett Sent: 19. joulukuuta 2007 10:08 To: dir...@li... Subject: [DirectPython] directinput and MAME? I'm trying to send keystrokes from Python to MAME. In case anyone's interested and doesn't know, MAME is an emulator to play classic arcade games (mamedev.org). I'm sending keystrokes from Python on Win32 like this: import win32api import win32com.client shell=win32com.client.Dispatch("WScript.Shell") shell.SendKeys("1") This works in everything but MAME which, as I've just learned, uses DirectInput. Can anyone think of a way to send keystrokes under this environment? I know it's possible, since there's a program called joykeys (http://members.aol.com/bretjohn/ <http://members.aol.com/bretjohn/> ) that translates joystick motion to keystrokes and works in Mame. Thanks for any help. Hi, You should be able to send keyboard events with win32api.keybd_event() ( http://msdn2.microsoft.com/en-us/library/ms646304.aspx ). These should work with applications using DirectInput for keyboard events too (at least with more recent OS versions, I think DirectInput used some more direct approach in older systems but I am not 100% sure about it). Just remeber that only the focus window will receive these events. Also note that SendInput() has superseded this function, but keybd_event() still works and is somewhat easier to use. -- Heikki Salo |
From: Alec B. <wry...@gm...> - 2007-12-19 08:07:42
|
I'm trying to send keystrokes from Python to MAME. In case anyone's interested and doesn't know, MAME is an emulator to play classic arcade games (mamedev.org). I'm sending keystrokes from Python on Win32 like this: import win32api import win32com.client shell=win32com.client.Dispatch("WScript.Shell") shell.SendKeys("1") This works in everything but MAME which, as I've just learned, uses DirectInput. Can anyone think of a way to send keystrokes under this environment? I know it's possible, since there's a program called joykeys ( http://members.aol.com/bretjohn/) that translates joystick motion to keystrokes and works in Mame. Thanks for any help. |
From: Heikki S. <ho...@gm...> - 2007-12-01 14:37:07
|
> -----Original Message----- > From: Skepsis [mailto:sk...@bl...] > Sent: 30. marraskuuta 2007 22:28 > To: ho...@gm... > Subject: Re: [DirectPython] Sending keys > > Sorry forthe direct mail ... I can not seem to reply tothe > discussion board? > > Thanks for the mail. I will check them out but the problem is > that the normal methods of sending input like win32 send > message / keyboard_event mouse_event even > the neat Sendkeys module, only work for 'normal' windows. > I need to > control game program windows and these are not affected by > the normal methods. > > I have yet to try post message and the sendInput you pointed > me to once I understand it some :) and you are right I dont > know C or C++. > > Thanks again > Adrian > I added the mailing list to receivers, just in case someone else is interested about this. As you have noticed, keyboard_event() and others only work with native Windows controls. Most games don't use them because they usually need some special styles or effects. Games running in fullscreen can't use them even if they wanted (with some minor exceptions). So the usual solution is to implement "windowless" controls. They create custom windows which are specific to the application. Windows (the operating system, that is) does not know anything about them. The d3dgui module which comes with DirectPython is one example. Some normal applications also use windowless controls (like Internet Explorer). So how do they expose themself to the user? Normally they don't have to do much. When a user moves the mouse (or presses a key etc.), the main window receives the event and the application then figures out what widget should receive it. Everything works fine as long as the user is conserned. Problems arise when you need to use these things without normal (mouse and keyboard) methods. For example testing, usability support and in you case voice control are harder with windowless applications. There are several ways in which you can dig information about these controls that are normally invisible to the operating system. These are some common ways in which windowless applications expose their "internals": -Implement Windows Active accessibility API. Implement IAccessible COM-object that provides information about the custom controls. This is a normal way to support screen readers and other accessibility applications. -Implement custom COM/OLE support. Microsoft Office, Internet explorer and some other applications can be controlled programmatically and information can be asked about their contents. -Implement some other accessibility protocol. -No support, use OCR and other methods to dig info about the application. -No support, you must reverse engineer the data structures used by the program. This is difficult and dangerous, but sometimes there are no alternatives if you have to do it. If you only need to support windowless applications created using Python and they use open-source windowless GUI-libraries, there is another way. It might sound weird or difficult, but it should usually work quite well. Not for the faint of heart, though! It also requires some C-experience, altough it is be possible to write dll's with other langueages. Suppose you want to get information about the process A, which uses d3dgui-library (or it can use some pygame GUI, it does not matter much) for it's controls. No normal method works, so you have to get creative. Your voice control application is process B. Create a very basic .dll which is then injected into procees A. The dll uses Python C-API to find the module d3dgui and overrides (for example) Manager.render() class method or adds a property which just monitors the custom controls and notifies process B about the existing controls (like position and text). Different GUI-libraries require different approaches, but the principle is same. You can also use a debugger to figure out how the application works internally. You could also try to modify the application before it starts (especially if it is done by py2exe or some similar method), but it can cause some problems. However, that could be easier than doing it on the fly. Without knowing more accurately what your application does, I can't give much more hints. It's up to you to decide what you need are how much work are you willing to do for it. -- Heikki Salo |