Mercurial > sypikslang
diff gamelib/gamegui.py @ 249:8c237a830efe
merge
author | Rizmari Versfeld <rizziepit@gmail.com> |
---|---|
date | Sun, 13 May 2012 00:51:29 +0200 |
parents | 25ea20b9803c 235b1faf590e |
children | c5fdfa96cfb2 |
line wrap: on
line diff
--- a/gamelib/gamegui.py Sun May 13 00:50:20 2012 +0200 +++ b/gamelib/gamegui.py Sun May 13 00:51:29 2012 +0200 @@ -3,7 +3,6 @@ """Gui for the actual game""" -from pygame import image try: import simplejson json = simplejson @@ -11,7 +10,7 @@ import json -from gamelib.data import filepath +from gamelib.data import load_image from gamelib.game_base import get_save_filename from gamelib.gui_base import (Window, TextLabel, TextBox, font_small, font_medium, font_large) @@ -169,9 +168,9 @@ WIDTH = 260 HEIGHT = 48 - BG_IMAGE_NORMAL = image.load(filepath('images/science_normal.png')) - BG_IMAGE_DOWN = image.load(filepath('images/science_down.png')) - BG_IMAGE_SELECTED = image.load(filepath('images/mission_selected.png')) + BG_IMAGE_NORMAL = load_image('images/science_normal.png') + BG_IMAGE_DOWN = load_image('images/science_down.png') + BG_IMAGE_SELECTED = load_image('images/mission_selected.png') def __init__(self, mission, pos, parent): self.mission = mission @@ -238,9 +237,9 @@ WIDTH = 260 HEIGHT = 48 - BG_IMAGE_NORMAL = image.load(filepath('images/science_normal.png')) - BG_IMAGE_DOWN = image.load(filepath('images/science_down.png')) - BG_IMAGE_UNAVAILABLE = image.load(filepath('images/equip_grey.png')) + BG_IMAGE_NORMAL = load_image('images/science_normal.png') + BG_IMAGE_DOWN = load_image('images/science_down.png') + BG_IMAGE_UNAVAILABLE = load_image('images/equip_grey.png') def __init__(self, equip, pos, parent, copies, available): self.equip = equip @@ -434,15 +433,19 @@ # Clear existing widgets, and turn this into a won screen for child in self.children[:]: self.remove_child(child) + # Replace background + self.background_image = load_image('images/main_background.jpg') exitbut = ExitGameButton() + # FIXME: 1:20 minutes to hackery here + exitbut.rect.topleft = (500, 350) self.add_child(exitbut) - title = TextLabel((200, 20, 400, 50), "Results for turn %d" % turn, + title = TextLabel((500, 20, 200, 50), "Results for turn %d" % turn, font_medium, (255, 255, 255)) self.add_child(title) - won = TextBox((200, 200, 400, 50), "You've succeeded in your quest", + won = TextBox((400, 200, 400, 50), "You've succeeded in your quest", font_large, (255, 255, 255)) self.add_child(won) - won = TextBox((200, 250, 400, 50), msg, font_large, + won = TextBox((450, 250, 400, 50), msg, font_large, (255, 255, 255)) self.add_child(won) @@ -558,8 +561,7 @@ def __init__(self, screen, lab): super(DevelopmentWindow, self).__init__(screen, lab.game) - self.background_image = image.load( - filepath('images/engineering_background.jpg')) + self.background_image = load_image('images/engineering_background.jpg') self.lab = lab labbut = SwitchWinButton((150, 0), 'SCIENCE!!', lab) @@ -628,8 +630,7 @@ self.game = Game(game_dict) super(LabWindow, self).__init__(screen, self.game) self.autosave = get_save_filename() - self.background_image = image.load( - filepath('images/lab_background.jpg')) + self.background_image = load_image('images/lab_background.jpg') # Ensure we setup everything with the correct state set self.game.start_turn()