comparison gamelib/scenes/engine.py @ 825:c5171ad0c3cd pyntnclick

Make engine computer start using text for alerts
author Neil Muller <neil@dip.sun.ac.za>
date Tue, 29 Jan 2013 12:45:54 +0200
parents eed75a1d50c4
children 340632d9a444
comparison
equal deleted inserted replaced
824:9f542ef6e498 825:c5171ad0c3cd
1 """Engine room where things need to be repaired.""" 1 """Engine room where things need to be repaired."""
2 2
3 from pyntnclick.i18n import _ 3 from pyntnclick.i18n import _
4 from pyntnclick.cursor import CursorSprite 4 from pyntnclick.cursor import CursorSprite
5 from pyntnclick.utils import render_text
5 from pyntnclick.state import Scene, Item, Thing, Result 6 from pyntnclick.state import Scene, Item, Thing, Result
6 from pyntnclick.scenewidgets import ( 7 from pyntnclick.scenewidgets import (
7 InteractNoImage, InteractRectUnion, InteractImage, InteractAnimated, 8 InteractNoImage, InteractRectUnion, InteractImage, InteractAnimated,
8 GenericDescThing, TakeableThing) 9 GenericDescThing, TakeableThing)
9 10
544 FOLDER = "engine" 545 FOLDER = "engine"
545 BACKGROUND = "engine_comp_detail.png" 546 BACKGROUND = "engine_comp_detail.png"
546 NAME = "engine_comp_detail" 547 NAME = "engine_comp_detail"
547 548
548 ALERTS = { 549 ALERTS = {
549 'cryo leaking': 'ec_cryo_leaking.png', 550 'cryo leaking': _("Cryo system leaking!"),
550 'cryo empty': 'ec_cryo_reservoir_empty.png', 551 'cryo empty': _("Cryo reservoir empty!"),
551 'super malfunction': 'ec_cryo_super_malfunction.png', 552 'super malfunction': _("Superconductor malfunction!"),
552 } 553 }
553 554
554 # Point to start drawing changeable alerts 555 # Point to start drawing changeable alerts
555 ALERT_OFFSET = (16, 100) 556 ALERT_OFFSET = (16, 100)
556 ALERT_SPACING = 4 557 ALERT_SPACING = 4
557 558
558 def setup(self): 559 def setup(self):
559 self._alert_messages = {} 560 self._alert_messages = {}
560 for key, name in self.ALERTS.iteritems(): 561 for key, msg in self.ALERTS.iteritems():
561 self._alert_messages[key] = self.get_image(self.FOLDER, name) 562 self._alert_messages[key] = render_text(msg, 'DejaVuSans-Bold.ttf',
563 30, 'red', (0, 0, 0, 0), self.resource, (480, 33), False)
562 564
563 def _draw_alerts(self, surface): 565 def _draw_alerts(self, surface):
564 xpos, ypos = self.ALERT_OFFSET 566 xpos, ypos = self.ALERT_OFFSET
565 engine = self.game.scenes['engine'] 567 engine = self.game.scenes['engine']
566 if not engine.things['engine.cracked_pipe'].get_data('fixed'): 568 if not engine.things['engine.cracked_pipe'].get_data('fixed'):