Skip to main content

input.py

This is a wrapper class to simplify control handling in pygame when using multiple controller methods.


Beerman
(beerman)

Rather than your game logic having to deal with all the controllers directly, it allows you to define named controls which can map to multiple controllers at once.

Simple example:

input = Input()
while running:
  input.Poll()
 
  ship.x += input.GetControl('THRUST')
  ship.y += input.GetControl('CLIMB')
  if input.GetControl('FIRE')
    ship.fire()
 
  if input.GetControl('QUIT'):
    running = False
 
  render()

Changes

Links

Home Page
http://www.beercave.co.uk/content/inputpy

Releases

input.py 1.0 — 5 Jun, 2011

Pygame.org account Comments

  • Bee Nine 2013-04-05 18:11

    Nice! I'm looking forward to trying this out.