[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Force feedback wrapper for Python
- To: pygame-users@seul.org
- Subject: [pygame] Force feedback wrapper for Python
- From: Doug Holton <etd1@edtechdev.org>
- Date: Fri, 11 Jul 2003 17:21:37 -0500
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Fri, 11 Jul 2003 18:22:20 -0400
- Reply-to: pygame-users@seul.org
- Sender: owner-pygame-users@seul.org
- User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624
Hi,
Apparently some people at the university of North Carolina have
created a force feedback wrapper for Python using SWIG. I thought it
would be of interest to the pygame users. It wraps the Immersion
foundation classes (IFC) from Immersion (Windows only).
Unfortunately Immersion recently started charging for their SDK. But
you may not need it though to create basic force feedback effects.
pyIFC library (still requires compiling with SWIG and IFC apparently):
http://www.cs.unc.edu/Research/assist/developer.shtml
working demos (try NCDemo):
http://sourceforge.net/projects/uncbats/
map you can open with BATS demo: (don't unzip)
http://www.cs.unc.edu/Research/assist/bats/maps/nc%20railroads.zip
source for the demos and pyIFC:
http://cvs.sourceforge.net/cvstarballs/uncbats-cvsroot.tar.gz
http://cvs.sourceforge.net/cvstarballs/uncassist-cvsroot.tar.gz
And here are links to the Immersion and Microsoft DirectX SDKs and some
force feedback tutorials:
http://edtechdev.org/blog/archives/000924.html
Rough code sample adapted from NCDemo, this won't work as is:
from wxPython.wx import *
from pyIFC import *
import win32api
class Frame(wxFrame):
def __init__(self):
hinst = win32api.GetModuleHandle(None)
hwnd = self.GetHandle() # wxFrame window handle
self.dev = CImmDevice_CreateDevice(hinst, hwnd)
if self.dev != None:
self.tact = pyImmProject()
#This is an example of loading effects from an .ifr file
#created with IStudio, but you can create effects directly too.
if self.dev.GetDeviceType() == IMM_DEVICETYPE_DIRECTINPUT:
self.tact.OpenFile("NCTextureJoy.ifr", self.dev)
def playeffect(self)
#play an effect from the .ifr file:
self.tact.Stop()
effect = ? # some effect in the .ifr file
self.tact.Start(effect,IMM_EFFECT_DONT_CHANGE)