Mercurial > boomslang
changeset 732:4f34b36ee7c5 pyntnclick
Add constants subclass to gamelib, and get the title + icon from it
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Tue, 15 Jan 2013 23:15:11 +0200 |
parents | 2f74064bc779 |
children | d016ac9de1bd |
files | gamelib/main.py pyntnclick/constants.py pyntnclick/main.py |
diffstat | 3 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/gamelib/main.py Tue Jan 15 22:57:41 2013 +0200 +++ b/gamelib/main.py Tue Jan 15 23:15:11 2013 +0200 @@ -1,5 +1,6 @@ import scenes +from constants import SSConstants from menu import MenuScreen from endscreen import EndScreen from ss_state import SSState @@ -20,6 +21,9 @@ def __init__(self): super(SuspendedSentence, self).__init__(SSState) + def game_constants(self): + return SSConstants() + def main(): ss = SuspendedSentence()
--- a/pyntnclick/constants.py Tue Jan 15 22:57:41 2013 +0200 +++ b/pyntnclick/constants.py Tue Jan 15 23:15:11 2013 +0200 @@ -14,6 +14,10 @@ class GameConstants(object): + title = None + # Icon for the main window, in the icons basedir + icon = None + screen = (800, 600) snd_freq = 44100 snd_bitsize = -16
--- a/pyntnclick/main.py Tue Jan 15 22:57:41 2013 +0200 +++ b/pyntnclick/main.py Tue Jan 15 23:15:11 2013 +0200 @@ -154,9 +154,11 @@ sys.exit(1) else: pygame.display.set_mode(self.constants.screen, SWSURFACE) - pygame.display.set_icon(self.resource.get_image( - 'suspended_sentence24x24.png', basedir='icons')) - pygame.display.set_caption("Suspended Sentence") + if self.constants.icon: + pygame.display.set_icon(self.resource.get_image( + self.constants.icon, basedir='icons')) + if self.constants.title: + pygame.display.set_caption(self.constants.title) self.engine = Engine(self) # Initialize the special screens in the engine