changeset 3:6b9fa5e2fbc6

Add initial window that does very little
author Neil Muller <drnlmuller@gmail.com>
date Sun, 11 Sep 2011 12:27:30 +0200
parents 97d5921e974b
children c2761e15f66b
files mamba/__main__.py mamba/constants.py
diffstat 2 files changed, 38 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mamba/__main__.py	Sun Sep 11 12:26:59 2011 +0200
+++ b/mamba/__main__.py	Sun Sep 11 12:27:30 2011 +0200
@@ -1,4 +1,30 @@
+"""Main module for the game"""
+
+import sys
+import os
+import pygame
+from pygame.locals import SWSURFACE
+
+from .constants import SCREEN
+
+# For future use
+DEBUG = False
+if os.environ.get('DEBUG'):
+    DEBUG = True
+
 
 def main():
-    """ your app starts here
-    """
+    """Launch the currently unnamed mamab game"""
+
+    pygame.display.init()
+    pygame.font.init()
+    # TODO: Sound initialisation
+    pygame.display.set_mode(SCREEN, SWSURFACE)
+    pygame.display.set_caption('Mamba')
+
+    # Placeholder to do something for some time
+    import time
+    time.sleep(2)
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mamba/constants.py	Sun Sep 11 12:27:30 2011 +0200
@@ -0,0 +1,10 @@
+# Useful constants, as usual
+
+SCREEN = (800, 600)
+
+# Sound constants
+SCREEN = (800, 600)
+FREQ = 44100   # same as audio CD
+BITSIZE = -16  # unsigned 16 bit
+CHANNELS = 2   # 1 == mono, 2 == stereo
+BUFFER = 1024  # audio buffer size in no. of samples