ic master
authorFrank DeMarco <frank.s.demarco@gmail.com>
Thu, 26 Jan 2017 17:32:52 +0000 (12:32 -0500)
committerFrank DeMarco <frank.s.demarco@gmail.com>
Thu, 26 Jan 2017 17:32:52 +0000 (12:32 -0500)
.gitignore [new file with mode: 0644]
.gitmodules [new file with mode: 0644]
OPEN-GAME [new file with mode: 0755]
TicketWizard.py [new file with mode: 0644]
config [new file with mode: 0644]
lib/__init__.py [new file with mode: 0644]
lib/pgfw [new submodule]
reservation [new file with mode: 0644]
setup.py [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..5fc0e28
--- /dev/null
@@ -0,0 +1,6 @@
+*.pyc
+local/
+MANIFEST
+dist/
+build/
+draft/
diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..ea69e5f
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "lib/pgfw"]
+       path = lib/pgfw
+       url = makar:/var/www/git/pgfw/
diff --git a/OPEN-GAME b/OPEN-GAME
new file mode 100755 (executable)
index 0000000..fb75bc4
--- /dev/null
+++ b/OPEN-GAME
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+from os import environ, execvp, chdir, getcwd
+from os.path import exists, join, dirname
+from sys import version_info, argv, maxint
+
+def can_import(module_name):
+    try:
+        __import__(module_name)
+    except ImportError:
+        return False
+    else:
+        return True
+
+def is_python_3():
+    return version_info[0] >= 3
+
+def is_current_version(file_name):
+    version = map(int, file_name.replace("python", "").split("."))
+    return version == list(version_info)[:2]
+
+def launch_alternative(alternatives):
+    for alternative in alternatives:
+        if not is_current_version(alternative):
+            for root in environ["PATH"].split(":"):
+                if exists(join(root, alternative)):
+                    execvp(alternative, [alternative] + argv)
+
+def move_to_executable():
+    chdir(dirname(argv[0]))
+
+if is_python_3():
+    launch_alternative(["python2", "python2.7", "python2.6"])
+
+if maxint >> 33:
+    launch_alternative(["python-32", "python2-32", "python2.7-32", "python2.6-32"])
+
+if not can_import("pygame"):
+    launch_alternative(["python2.7", "python2.6"])
+
+if "--go-to-dir" in argv:
+    move_to_executable()
+
+from TicketWizard import TicketWizard
+
+TicketWizard().run()
diff --git a/TicketWizard.py b/TicketWizard.py
new file mode 100644 (file)
index 0000000..449be7a
--- /dev/null
@@ -0,0 +1,48 @@
+from pygame import Rect, Surface, Color, mixer, PixelArray
+from pygame.image import load
+from pygame.mixer import Sound
+from pygame.transform import scale
+from pygame.font import Font
+
+from lib.pgfw.pgfw.Game import Game
+from lib.pgfw.pgfw.GameChild import GameChild
+from lib.pgfw.pgfw.Sprite import Sprite
+
+class SoundEffect(GameChild, Sound):
+
+    def __init__(self, parent, path, volume=1.0):
+        GameChild.__init__(self, parent)
+        Sound.__init__(self, path)
+        self.display_surface = self.get_display_surface()
+        self.initial_volume = volume
+        self.set_volume(volume)
+
+    def play(self, loops=0, maxtime=0, fade_ms=0, position=None, x=None):
+        self.set_volume(self.initial_volume *
+                        self.get_configuration("audio", "sfx-volume"))
+        channel = Sound.play(self, loops, maxtime, fade_ms)
+        if x is not None:
+            position = float(x) / self.display_surface.get_width()
+       if position is not None and channel is not None:
+            channel.set_volume(*self.get_panning(position))
+        return channel
+
+    def get_panning(self, position):
+        return 1 - max(0, ((position - .5) * 2)), \
+               1 + min(0, ((position - .5) * 2))
+
+
+class TicketWizard(Game):
+
+    def __init__(self):
+        Game.__init__(self)
+        self.subscribe(self.respond)
+
+    def reset(self):
+        pass
+
+    def respond(self, event):
+        pass
+
+    def update(self):
+        pass
diff --git a/config b/config
new file mode 100644 (file)
index 0000000..0dd2c39
--- /dev/null
+++ b/config
@@ -0,0 +1,23 @@
+[setup]
+license = Public Domain
+title = Ticket Wizard
+url = http://A-O.in/
+version = 0.1.1
+init-script = OPEN-GAME
+additional-packages = lib
+data-exclude = local/, *.pyc
+
+[display]
+caption = Synchrony Ticket Wizard
+show-framerate = False
+dimensions = 800, 600
+fullscreen = yes
+
+[mouse]
+visible = False
+
+[keys]
+quit = K_ESCAPE
+
+[audio]
+sfx-volume = .8
diff --git a/lib/__init__.py b/lib/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/lib/pgfw b/lib/pgfw
new file mode 160000 (submodule)
index 0000000..470e1a6
--- /dev/null
+++ b/lib/pgfw
@@ -0,0 +1 @@
+Subproject commit 470e1a66de2ea72d8c569e098b8c9d75e8eff0d7
diff --git a/reservation b/reservation
new file mode 100644 (file)
index 0000000..7292b88
--- /dev/null
@@ -0,0 +1 @@
+5002A1 ohsqueezy
diff --git a/setup.py b/setup.py
new file mode 100644 (file)
index 0000000..89de182
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,13 @@
+from sys import platform
+
+if __name__ == "__main__":
+    if platform == "darwin":
+        from lib.pgfw.pgfw.SetupOSX import SetupOSX
+        SetupOSX("OPEN-GAME",
+                 ["HEAVENSlime.py", "resource", "lib", "config"]).setup()
+    elif platform == "win32":
+        from lib.pgfw.pgfw.SetupWin import SetupWin
+        SetupWin().setup()
+    else:
+        from lib.pgfw.pgfw.Setup import Setup
+        Setup().setup()