Exemple #1
0
 def __init__(self, x, y, width, height):
     self.win = UCS.newwin(height, width, y, x)
     self.x = x
     self.y = y
     self.width = width
     self.height = height
     return
Exemple #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
Exemple #3
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
Exemple #4
0
 def destroy(self):
     UCS.endwin()
     return
Exemple #5
0
 def refresh(self):
     UCS.wrefresh(self.win)
     return
Exemple #6
0
 def __init__(self, gmap):
     UCS.stdscr = UCS.initscr()
     UCS.noecho()
     UCS.start_color()
     self.screen_h, self.screen_w = UCS.getmaxyx(UCS.stdscr)
     self.map_win = MapWindow(0, 0,
                              self.screen_w * 3/4,
                              self.screen_h,
                              gmap)
     self.hud_win = HudWindow(self.map_win.width, 0,
                              self.screen_w - self.map_win.width,
                              self.screen_h)
     
     UCS.init_pair(self.HUD_PAIR,
                   UCS.COLOR_BLACK, UCS.COLOR_WHITE)
     UCS.init_pair(self.MAP_DEFAULT_PAIR,
                   UCS.COLOR_WHITE, UCS.COLOR_BLACK)
     UCS.init_pair(self.MAP_RED_PAIR,
                   UCS.COLOR_RED, UCS.COLOR_BLACK)
     UCS.init_pair(self.MAP_BLUE_PAIR,
                   UCS.COLOR_BLUE, UCS.COLOR_BLACK)
     UCS.init_pair(self.MAP_GREEN_PAIR,
                   UCS.COLOR_GREEN, UCS.COLOR_BLACK)
     UCS.init_pair(self.MAP_MAGENTA_PAIR,
                   UCS.COLOR_MAGENTA, UCS.COLOR_BLACK)
     UCS.wbkgd(self.map_win.win, UCS.COLOR_PAIR(self.MAP_DEFAULT_PAIR))
     UCS.wbkgd(self.hud_win.win, UCS.COLOR_PAIR(self.HUD_PAIR))
     return