[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] pyGame - Logitech rumble pad input OS X (10.3.9)
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] pyGame - Logitech rumble pad input OS X (10.3.9)
- From: Rene Dudfield <renesd@xxxxxxxxx>
- Date: Sat, 10 Sep 2005 15:29:50 +1000
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Sat, 10 Sep 2005 01:30:03 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=e4qvxMYERnWHJsSOkSHz7COTl/7fspSKOX80cLV1308+B0osytujc88NjVIvX2zmAZGQCEZpfGfBXKb/QM64oF7ZCESCv2sVftakzj6IWX8sIoQPR1Rc8iYHoS0elePW93qC8GVpXWgvEU/3don0ke7YnJaJ/tfCr43PzchRLiQ=
- In-reply-to: <BF475DC5.27A7%kjmacken@yorku.ca>
- References: <64ddb72c05083116113fc94c93@mail.gmail.com> <BF475DC5.27A7%kjmacken@yorku.ca>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hey,
looks like you forgot the ()
for e in pygame.event.get:
for e in pygame.event.get():
Also you don't need the pump call if you are doing the get().
Cheers,
On 9/10/05, Kevin J. MacKenzie <kjmacken@xxxxxxxx> wrote:
>
> On 8/31/05 7:11 PM, "Rene Dudfield" <renesd@xxxxxxxxx> wrote:
>
> > hey,
> >
> > have a look at eventlist.py in the examples. Run it, and you will see
> > events drawn to the screen.
> >
> > Cheer.
> >
> > Yeah, you're calling pygame.event.pump() when you want pygame.event.get().
> >
> > At least, I'm pretty sure that's your problem.
> >
> > Cheers,
> > Terry
>
> Hi,
>
> I have finally been able to get back to working on this. I played with the
> eventlist.py example with little luck in polling the joystick events.
>
> I am presently polling the event queue using the following code:
>
> while not done:
> pygame.event.pump()
> #events = pygame.event.get()
> for e in pygame.event.get:
> if e.type in (KEYDOWN, KEYUP, QUIT):
> print 'leaving'
> sys.exit()
> done = True
> elif e.type in (JOYBUTTONDOWN,JOYBUTTONUP):
> print "a joystick button has been hit"
>
> And having no luck getting gamepad events. Printing out the entire event
> cue will give me mouse motion events, keypresses, mouse button states etc.
> However, I'm having no luck getting any input from the Logitech Gamepad.
>
> I have pasted my full code example below, and I'm hoping that I'm doing
> something trivially wrong.
>
> Initializing the joystick returns the proper name and properties of the
> joystick, so I assume that it is being properly recognized from within
> pygame.
>
> I am using Mac OS X (10.3.9) with the USB overdrive drivers for the Gamepad.
>
> I appreciate any assistance anyone can lend me. Thanks.
>
> Kjm
>
> #!/usr/bin/env python
> ############################################################################
> ####
> import pygame
> import pygame.joystick
> from pygame.locals import *
> from Numeric import *
>
> import sys
> ############################################################################
> ####
>
>
>
> ############################################################################
> ####
> # global decs
> xpix = 100
> ypix = 100
> global RES
> RES = array((xpix,ypix))
>
> ############################################################################
> ####
> # init a joystick object
> # def init_joy():
> pygame.joystick.init() # init the joystick module
> pygame.joystick.get_init() # verify the initialization
>
> joystick_count = pygame.joystick.get_count()
> print('%d joystick(s) connected' %joystick_count)
>
> joystick_object = pygame.joystick.Joystick(0)
> # this creates an instance of a joystick object
> #
> # Assumes only 1 joystick connected, and will use the first in the list
>
> #--------------------------------
> # This stuff is mostly chaff and can get removed for running experimental
> code
> joystick_object.get_name()
> print joystick_object.get_name()
>
> joystick_object.init()
> joystick_object.get_init()
> print ('Joystick object status = %d' %joystick_object.get_init())
>
> num_axes = joystick_object.get_numaxes()
> num_buttons = joystick_object.get_numbuttons()
>
> print 'Joystick has %d axes and %d buttons' %(num_axes,num_buttons)
>
> ############################################################################
> ####
>
>
> ############################################################################
> ####
> def init_pygame():
> '''Initialize pygame. Here is where you will stick window dimensions
> etc.'''
> pygame.display.init()
> screen = pygame.display.set_mode(RES, 0, 32)
>
> ############################################################################
> ####
>
>
> ############################################################################
> ####
> def main():
> init_pygame()
> done = False
>
>
> while not done:
> pygame.event.pump()
> #events = pygame.event.get()
> for e in pygame.event.get:
> if e.type in (KEYDOWN, KEYUP, QUIT):
> print 'leaving'
> sys.exit()
> done = True
> elif e.type in (JOYBUTTONDOWN,JOYBUTTONUP):
> print "a joystick button has been hit"
>
>
>
>
> pygame.joystick.quit()
> sys.exit()
> ############################################################################
> ####
>
>
> if __name__ == "__main__":
> main()
>
>
>