Permalink
Browse files

Initial commit.

  • Loading branch information...
dalethatcher committed Jul 30, 2012
1 parent ca2c89a commit 82c1be0f2d8a4fc45582dfed91ec9dc857352350
Showing with 52 additions and 0 deletions.
  1. +48 −0 board.py
  2. BIN down.wav
  3. BIN left.wav
  4. BIN right.wav
  5. +4 −0 run.sh
  6. BIN up.wav
View
@@ -0,0 +1,48 @@
+import pygame
+import time
+import curses
+
+pygame.init()
+
+up = pygame.mixer.Sound('up.wav')
+down = pygame.mixer.Sound('down.wav')
+left = pygame.mixer.Sound('left.wav')
+right = pygame.mixer.Sound('right.wav')
+
+screen = curses.initscr()
+curses.noecho()
+curses.curs_set(0)
+screen.keypad(1)
+
+screen.clear()
+
+while True:
+ screen.addstr(1, 0, "Ready to accept up, down, left or right to play sounds or q to quit!")
+ screen.addstr(2, 0, "To get to a new console press Alt-F2")
+
+ event = screen.getch()
+
+ screen.clear()
+
+ if event == ord('q'):
+ break
+ elif event == curses.KEY_UP:
+ screen.addstr(0, 0, "You pressed up!")
+ up.play()
+ elif event == curses.KEY_DOWN:
+ screen.clear()
+ screen.addstr(0, 0, "You pressed down!")
+ down.play()
+ elif event == curses.KEY_LEFT:
+ screen.clear()
+ screen.addstr(0, 0, "You pressed left!")
+ left.play()
+ elif event == curses.KEY_RIGHT:
+ screen.clear()
+ screen.addstr(0, 0, "You pressed right!")
+ right.play()
+ else:
+ screen.clear()
+ screen.addstr(0, 0, "That key doesn't do anything!")
+
+curses.endwin()
View
BIN down.wav
Binary file not shown.
View
BIN left.wav
Binary file not shown.
View
BIN right.wav
Binary file not shown.
View
4 run.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd `dirname $0`
+/usr/bin/python board.py
View
BIN up.wav
Binary file not shown.

0 comments on commit 82c1be0

Please sign in to comment.