Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tools.py
diff options
context:
space:
mode:
authorBrian Jordan <bcjordan@gmail.com>2009-05-25 07:57:03 (GMT)
committer Brian Jordan <bcjordan@gmail.com>2009-05-25 07:57:03 (GMT)
commit2202de8257083535d796c2e1e66e099de5ad5110 (patch)
tree3ceec16eaeb057dc1c4c5b4e2ef0a1ccde88016e /tools.py
parent7c1e5eff0c7040498f78b2976c5fed84649903cc (diff)
Removed unfinished "joystick" feature
Diffstat (limited to 'tools.py')
-rw-r--r--tools.py70
1 files changed, 1 insertions, 69 deletions
diff --git a/tools.py b/tools.py
index 0ce23d9..41bc52f 100644
--- a/tools.py
+++ b/tools.py
@@ -43,39 +43,7 @@ class Tool(object):
self.game.setTool("magicpen")
#elif event.key == K_g:
# self.game.setTool("gear")
- # Game/joystick-related keys
- elif event.key == K_KP4: # Left gamepad, left arrow
- if self.game.joystickobject:
- self.game.joystickobject[0].ApplyTorque(9000)
- elif self.game.debug: print "Left gamepad left arrow error: no joystick object selected"
- elif event.key == K_KP6: # Left gamepad, right arrow
- if self.game.joystickobject:
- self.game.joystickobject[0].ApplyTorque(9000)
- elif self.game.debug: print "Left gamepad right arrow error: no joystick object selected"
- elif event.key == K_KP8: # Left gamepad, up arrow
- if self.game.joystickobject:
- self.game.joystickobject[0].ApplyTorque(9000)
- elif self.game.debug: print "Left gamepad up arrow error: no joystick object selected"
- elif event.key == K_KP2: # Left gamepad, down arrow
- if self.game.joystickobject:
- self.game.joystickobject[0].ApplyTorque(9000)
- elif self.game.debug: print "Left gamepad down arrow error: no joystick object selected"
- elif event.key == K_KP7: # Right gamepad, square
- if self.game.joystickobject:
- self.game.joystickobject[0].ApplyTorque(-9000)
- elif self.game.debug: print "Right gamepad square button error: no joystick object selected"
- elif event.key == K_KP1: # Right gamepad, check
- if self.game.joystickobject:
- self.game.joystickobject[0].ApplyTorque(-9000)
- elif self.game.debug: print "Right gamepad check button error: no joystick object selected"
- elif event.key == K_KP9: # Right gamepad, circle
- if self.game.joystickobject:
- self.game.joystickobject[0].ApplyTorque(-9000)
- elif self.game.debug: print "Right gamepad circle button error: no joystick object selected"
- elif event.key == K_KP3: # Right gamepad, X
- if self.game.joystickobject:
- self.game.joystickobject[0].ApplyTorque(-9000)
- elif self.game.debug: print "Right gamepad X button error: no joystick object selected"
+
elif event.type == USEREVENT:
if hasattr(event,"action"):
if self.game.toolList.has_key(event.action): self.game.setTool(event.action)
@@ -394,42 +362,6 @@ class DestroyTool(Tool):
def cancel(self):
self.vertices = None
- # The joystick tool
-class JoystickTool(Tool):
- name = "joystick"
- icon = "magicpen" # for now
- toolTip = "Joystick"
-
- def __init__(self,gameInstance):
- self.game = gameInstance
- self.name = "Joystick"
- self.vertices = None
- #self.joystickobject
- def handleEvents(self,event):
- #look for default events, and if none are handled then try the custom events
- super(JoystickTool,self).handleEvents(event)
- if pygame.mouse.get_pressed()[0]:
- if not self.vertices:
- self.vertices = []
- self.vertices.append(pygame.mouse.get_pos())
- if len(self.vertices) > 10:
- self.vertices.pop(0)
- self.game.joystickobject = self.game.world.get_bodies_at_pos(pygame.mouse.get_pos())
- if self.game.joystickobject:
- print "hi1"
- #self.game.world.world.DestroyBody(self.joystickobject[0])
- elif event.type == MOUSEBUTTONUP and event.button == 1:
- self.cancel()
- def draw(self):
- # draw the trail
- if self.vertices:
- if len(self.vertices) > 1:
- pygame.draw.lines(self.game.screen,(255,0,0),False,self.vertices,3)
-
- def cancel(self):
- self.vertices = None
-
-
def getAllTools():
this_mod = __import__(__name__)
all = [val for val in this_mod.__dict__.values() if isinstance(val, type)]