directx controls through pygame

Post your own tutorials, guides and demos.

Post » Thu Sep 02, 2010 1:11 am

very basic example, more of a proof of concept
here it is being used to control a behavior
download pygame from here: [url:2ve28cr0]http://www.pygame.org/download.shtml[/url:2ve28cr0]
and copy the pygame folder to the python directory of construct
[url:2ve28cr0]http://dl.dropbox.com/u/1013446/pyjoy/pyjoy.cap[/url:2ve28cr0]
also, for anyone wondering, if you have a 360 controller, they're still dx compatible so you can still test this cap. if it moves at all, it's using directx input
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Thu Sep 02, 2010 7:03 am

Very nice, thanks Lucid.
B
3
S
1
G
2
Posts: 80
Reputation: 985

Post » Thu Sep 02, 2010 9:46 am

what am I doing wrong?
B
2
S
2
G
2
Posts: 158
Reputation: 1,366

Post » Sat Sep 04, 2010 1:37 am

Nice example Lucid, clean and simple.

In regards to the error.. If you are trying to run it as an exe then follow this guide:

viewtopic.php?f=8&t=5920&start=10

-------------------------------------
As far as getting PyGame to work with Construct just use this:
http://www.box.net/shared/kcoxzzt7bz

This has the dependencies for Pygame. You will need to unzip the contents of the Library.zip file into your Construct/Data/Python directory. You will need to check all of the .pyc files per the quickguide, but you can skip PodSixnet and other unrelated .pyc files. The other dependencies (modules.zip) have to be redistributed with your game. Now you don't need ALL of those, but it will be up to you to decide which ones you need based on which parts of Pygame you use!
---------------------------------------------------------

Also, make sure you are using .99.93. (from your screenshot looks like 94) so you should be good.
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Thu Sep 09, 2010 9:02 pm

EDIT: Nevermind :oops: i just needed to init the display module as well, since the "event queue" is used. Trial and error, a part of learning lol

This works for me but it looks like it inits the entire Pygame library... it's my understanding that this isn't necessary, but i can't seem to make it just init the joystick module. I checked the pygame documentation, but the methods they provide to import and init pygame and it's modules don't work...

for example, you did this to import:
[code:1atoszdw]
from pygame import*;
[/code:1atoszdw]
but the documentation says to do this, and also says for some reason that the first line is the only necessary one.
[code:1atoszdw]
import pygame
from pygame.locals import *
[/code:1atoszdw]
which throws an error. And replacing your init() with joystick.init() doesn't work, but shouldn't it? The inconsistencies are confusing me, help please? :?
B
2
G
2
Posts: 14
Reputation: 678

Post » Fri Sep 10, 2010 12:26 am

I wonder...

PyGame is a wrapper to sdl. sdl is written in c, fully supported in c++, and open source. I found that the joystick support is just on file with a few headers: [url:2v9frqga]http://hg.libsdl.org/SDL/file/0972c2893e68/src/joystick/win32/SDL_dxjoystick.c[/url:2v9frqga]

We have a few ambitious c/c++ programmers in the community. I don't have much knowledge of actual development with c++, but wouldn't it be possible (without months of 16h per day work) to pack this to a plugin?
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Fri Sep 10, 2010 1:03 am

[quote="tulamide":3q7zdme3]I don't have much knowledge of actual development with c++, but wouldn't it be possible (without months of 16h per day work) to pack this to a plugin?[/quote:3q7zdme3]
Sounds very doable. I think somebody mentioned they were working on a joystick plugin last week. Hopefully they are using that SDL connection.
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Sun Sep 19, 2010 8:49 pm

[quote="scidave":a10gn45s]Sounds very doable. I think somebody mentioned they were working on a joystick plugin last week. Hopefully they are using that SDL connection.[/quote:a10gn45s]

I'm building a joystick plugin but it will be more like an "Input System" with Keyboard+Mouse+Joystick all managed through directX. So, i've merged "Keyboard & Mouse" plugin actions/conditions/expressions to my "Input System" and I've added an "Arm" feature like in the "Custom Controls" plugin by Lucid.

The coding is at 50% finished and it works well with my Cyborg EVO, Xbox 360 pad and my Thrustmaster Racing Wheel. Force Feedback may be included in the plugin...

By the way, I'm using the Win32 part of OIS (http://sourceforge.net/projects/wgois/).
B
3
S
1
G
2
Posts: 80
Reputation: 985

Post » Mon Sep 20, 2010 10:59 pm

[quote="sglorz":3h331biq]I'm building a joystick plugin but it will be more like an "Input System" with Keyboard+Mouse+Joystick all managed through directX.[/quote:3h331biq]
I love you.

Any suport for runtime input configuration and getting joystick's hardware name string? 'Cause I'd love that.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Tue Sep 21, 2010 6:07 am

[quote="madster":29itasqn]
Any suport for runtime input configuration and getting joystick's hardware name string? 'Cause I'd love that.[/quote:29itasqn]

Yes, both already done. These were some of the main reasons I'm doing the plugin :wink:
B
3
S
1
G
2
Posts: 80
Reputation: 985

Next

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests