Exemplo n.º 1
0
 def run(self):
   self.hero = core.game.save_data.hero
   core.wm.set_screen("inventory")
   self.focus()
   core.screen.fill(self.bg)
   draw_round_border(core.screen, bounds=Rect(2,2,317,476))
   draw_round_border(core.screen, bounds=Rect(321,2,317,476))
   self.hero.add_observer(self,self.character_fields)
   self.inventory = self.hero.inventory
   self.cache_stats()
   self.cache_inventory()
   if len(self.inventory) > 0:
       self.selection = 0
   else:
       self.selection = -1
   self.draw_cursor()
Exemplo n.º 2
0
Arquivo: hud.py Projeto: bpa/renegade
    def __init__(self, hero):
        self.fg = color.Color('white')
        self.bg = color.Color('blue')
        self.tr = color.Color('black')

        self.bgwin = core.wm.window(-8,24,4,-28,z=7,name="HUD Background")
        self.bgwin.image.fill(self.bg)
        self.bgwin.image.set_alpha(128)

        self.borderwin = core.wm.window(height=32,y=-32,z=6,name="HUD Border")
        self.borderwin.image.fill(self.tr)
        dialog.draw_round_border(self.borderwin.image,color=self.fg)
        self.borderwin.image.set_colorkey(self.tr, RLEACCEL)

        rect = core.wm.make_rect_from_relative(8,-28,-16,25)
        StaticWindow.__init__(self,rect,z=5)
        self.update = self.real_update
        self.set_hero(hero)
        self.font = font.Font(None, 20)
        self.rows = 2
        self.image.set_colorkey(self.tr, RLEACCEL)
Exemplo n.º 3
0
    def __init__(self, text, options=None):
        self.options = options
        if options is not None:
            self.selection = 0
        else:
            self.selection = None

        self.fg = pygame.color.Color('white')
        self.bg = pygame.color.Color('blue')
        self.tr = pygame.color.Color('black')

        half = core.screen.get_width() * 4 / 5
        self.rect = Rect(0,0,half,0)
        self.text = text
        self.font = pygame.font.Font(None, 20)
        self.split_text()
        self.render_text()

        self.window = core.wm.window(half,self.rect.height,'center','center')
        self.window.update = self.update
        self.window.handle_event = self.handle_event
        self.screen = self.window.image
        self.screen.set_colorkey(self.tr, RLEACCEL)

        self.rect = Rect(self.window.rect)
        self.rect.center = self.screen.get_rect().center

        r = self.rect.inflate(-6,-6)
        self.bgwin = core.wm.window(r.width,r.height,'center','center',z=3)
        self.bgwin.image.fill(self.bg)
        self.bgwin.image.set_alpha(128)

        self.borderwin = core.wm.window(self.rect.width,self.rect.height, \
            'center','center', z=2)
        self.borderwin.image.fill(self.tr)
        dialog.draw_round_border(self.borderwin.image,color=self.fg)
        self.borderwin.image.set_colorkey(self.tr, RLEACCEL)