comparison gamelib/scenes/cryo.py @ 830:a1c0c1078342 pyntnclick

Convert cryo computer detail to use text
author Neil Muller <neil@dip.sun.ac.za>
date Tue, 29 Jan 2013 15:15:00 +0200
parents eed75a1d50c4
children bdebe693453f
comparison
equal deleted inserted replaced
829:b78cacda84d5 830:a1c0c1078342
1 """Cryo room where the prisoner starts out.""" 1 """Cryo room where the prisoner starts out."""
2 2
3 import random 3 import random
4 4
5 from pyntnclick.i18n import _ 5 from pyntnclick.i18n import _
6 from pyntnclick.utils import render_text
6 from pyntnclick.cursor import CursorSprite 7 from pyntnclick.cursor import CursorSprite
7 from pyntnclick.state import Scene, Item, CloneableItem, Thing, Result 8 from pyntnclick.state import Scene, Item, CloneableItem, Thing, Result
8 from pyntnclick.scenewidgets import ( 9 from pyntnclick.scenewidgets import (
9 InteractNoImage, InteractRectUnion, InteractImage, InteractAnimated, 10 InteractNoImage, InteractRectUnion, InteractImage, InteractAnimated,
10 GenericDescThing, TakeableThing) 11 GenericDescThing, TakeableThing)
499 500
500 class CryoCompDetail(Scene): 501 class CryoCompDetail(Scene):
501 502
502 FOLDER = "cryo" 503 FOLDER = "cryo"
503 BACKGROUND = "comp_info_detail.png" 504 BACKGROUND = "comp_info_detail.png"
504 BACKGROUND_FIXED = "comp_info_detail_fixed.png"
505 NAME = "cryo_comp_detail" 505 NAME = "cryo_comp_detail"
506 506
507 def setup(self): 507 def setup(self):
508 self._background_fixed = self.get_image( 508 background = self.get_image(
509 self.FOLDER, self.BACKGROUND_FIXED) 509 self.FOLDER, self.BACKGROUND)
510 # Add the common text strings
511 bg = (0, 0, 0, 0)
512 fg = 'lightgreen'
513 font = 'DejaVuSans-Bold.ttf'
514 size = 18
515
516 background.blit(render_text(_("Info"),
517 font, 24, fg, bg, self.resource, (90, 25), False), (25, 60))
518 background.blit(render_text(_("Cryo Units Online: 2, 4"),
519 font, size, fg, bg, self.resource, (240, 30), False), (15, 120))
520 background.blit(render_text(_("Crew Active: 0"),
521 font, size, fg, bg, self.resource, (240, 30), False), (15, 170))
522 background.blit(render_text(_("Current Trip Time: 97558 days"),
523 font, size, fg, bg, self.resource, (340, 30), False), (15, 210))
524 background.blit(render_text(_("Expected Time of Arrival:"),
525 font, size, fg, bg, self.resource, (340, 30), False), (15, 240))
526
527 self._background_fixed = background.copy()
528 self._background_offline = background.copy()
529
530 self._background_fixed.blit(render_text(_("397 days"),
531 font, size, fg, bg, self.resource, (340, 30), False), (275, 240))
532
533 self._background_offline.blit(render_text(
534 _("<Error: Division by Zero Error>"),
535 font, size, fg, bg, self.resource, (340, 30), False), (275, 240))
510 536
511 def draw_background(self, surface): 537 def draw_background(self, surface):
512 if self.game.scenes['engine'].get_data('engine online'): 538 if self.game.scenes['engine'].get_data('engine online'):
513 surface.blit(self._background_fixed, self.OFFSET, None) 539 surface.blit(self._background_fixed, self.OFFSET, None)
514 else: 540 else:
515 surface.blit(self._background, self.OFFSET, None) 541 surface.blit(self._background_offline, self.OFFSET, None)
516 542
517 543
518 class CryoUnitWithCorpse(Scene): 544 class CryoUnitWithCorpse(Scene):
519 545
520 FOLDER = "cryo" 546 FOLDER = "cryo"