Пример #1
0
 def render(self):
     UCS.werase(self.win)
     start_x = (self.width - len(self.player.name)) / 2
     start_y = 1
     UCS.mvwaddstr(self.win, start_y, start_x, self.player.name)
     
     money_str = "$" + str(self.player.money)
     start_x = (self.width - len(money_str)) / 2
     start_y += 2
     UCS.mvwaddstr(self.win, start_y, start_x, money_str)
     
     terrain_str = Tile.HUD_STR[self.selected_tile.tiletype]
     start_x = (self.width - len(terrain_str)) / 2
     start_y += 3
     UCS.mvwaddstr(self.win, start_y, start_x, terrain_str)
     
     resident = self.selected_tile.resident
     if resident != None:
         res_str = Unit.HUD_STR[resident.unittype] + "\n"
         res_str += "HP: " + str(resident.hp) + "\n"
         res_str += "DP: " + str(resident.dp) + "\n"
         res_str += "AP: " + str(resident.ap) + "\n"
         res_str += "MP: " + str(resident.mp) + "\n"
         start_x = (self.width - len(res_str)) / 2
         start_x = 0
         start_y += 2
         UCS.mvwaddstr(self.win, start_y, start_x, res_str)
     
     start_x = (self.width - len(self.status)) / 2
     start_y = self.height - 5
     if start_x < 0:
         start_x = 0
     UCS.mvwaddstr(self.win, start_y, start_x, self.status)
     self.refresh()
     return
Пример #2
0
 def render(self):
     UCS.werase(self.win)
     for y in range(self.gmap_ref.height):
         for x in range(self.gmap_ref.width):
             if self.gmap_ref.tiles[x][y].owner == None:
                 pair = Renderer.MAP_DEFAULT_PAIR
             else:
                 pair = Renderer.PLAYERS_PAIRS[self.gmap_ref.tiles[x][y].owner.color]
             UCS.wattron(self.win, UCS.COLOR_PAIR(pair))
             scr_x, scr_y = self.real2screen(x, y)
             UCS.mvwaddstr(self.win,
                           scr_y,
                           scr_x,
                           self.gmap_ref.tiles[x][y].get_symbol() + " ")
             UCS.wattroff(self.win, UCS.COLOR_PAIR(pair))
     self.refresh()
     return