Exemplo n.º 1
0
    def render_popup_panel(self):
        win, rows, cols = self._init_render_window("popup")
        uc.box(win)\

        current_popup_list = self.state.current_popup_menu.get_current_list()

        # Show the title of the context.
        prompt = current_popup_list.header
        title_start_row = 1
        self._render_text(win,
                          title_start_row,
                          (cols/2) - (len(prompt)/2) - 1,
                          prompt,
                          cols-3,
                          uc.A_BOLD)

        selected_i = current_popup_list.i
        list_start_row = title_start_row + 2
        self._render_list(win,
                          current_popup_list,
                          list_start_row, rows-list_start_row,
                          2, cols-4,
                          selected_i,
                          self.is_active_window("popup"),
                          centered=True)
Exemplo n.º 2
0
 def _activate(self):
     box(self.button_window)
     mvwaddstr(self.button_window, ((self.height + 1) // 2) - 1, (self.width - len(self.name)) // 2 + 1, self.name)
     wbkgd(self.button_window, BLUE_WHITE)
     wrefresh(self.button_window)
     update_panels()
     doupdate()
Exemplo n.º 3
0
	def draw_board(self):
		uc.wclear(self.win_board1)
		uc.wclear(self.win_baord2)

		uc.box(self.win_boardarea, 0, 0)

		uc.wmove(self.win_boardarea, 1, 2)

		s1 = self.player.board.__str__()
		s2 = self.player_enemy.board.__str__()

		for chr in s1:
			if chr == '~':
				uc.wattron(self.win_board, uc.COLOR_PAIR(11))
				uc.waddstr(self.win_board, chr)
				uc.wattroff(self.win_board, uc.COLOR_PAIR(11))
			elif chr == 'O':
				uc.wattron(self.win_board, uc.COLOR_PAIR(12))
				uc.waddstr(self.win_board, chr)
				uc.wattroff(self.win_board, uc.COLOR_PAIR(12))
			elif chr == '#':
				uc.wattron(self.win_board, uc.COLOR_PAIR(13))
				uc.waddstr(self.win_board, chr)
				uc.wattroff(self.win_board, uc.COLOR_PAIR(13))
			else:
				uc.wattron(self.win_board, uc.COLOR_PAIR(12))
				uc.waddstr(self.win_board, chr)
				uc.wattroff(self.win_board, uc.COLOR_PAIR(12))

		uc.wrefresh(self.win_boardarea)
		uc.update_panels()
Exemplo n.º 4
0
 def refresh(self):
     if self.enabled and not self.blocked:
         self.draw()
         box(self.game_field_window)
         wrefresh(self.game_field_window)
         update_panels()
         doupdate()
Exemplo n.º 5
0
    def render(self, line=None):  # Overwrites existing
        if self.max_line_len > self.width:
            raise SizeError("Content is longer than box.")
        # New window
        self.win = uni.newwin(self.height, self.width, self.ypos, self.xpos)

        # Draw outline
        if self.outline:
            uni.box(self.win, 0, 0)
        # Draw label
        self.draw_label()

        # Make panel
        self.panel = uni.new_panel(self.win)

        # Track the line number currently written
        self.current_line = 0

        # Print content
        for line in self.lines:
            # Print line text on line number
            ix = list(self.lines).index(line)
            line_no = ix + self.ypad
            # Print lines according to the text's index in the list
            uni.mvwaddstr(self.win, line_no, self.xpad, " " * (self.width - 2))
            uni.mvwaddstr(self.win, line_no, self.xpad, line)
            self.current_line += 1
            uni.wrefresh(self.win)
Exemplo n.º 6
0
 def refresh(self):
     if self.enabled and not self.blocked:
         self.draw()
         box(self.game_field_window)
         wrefresh(self.game_field_window)
         update_panels()
         doupdate()
Exemplo n.º 7
0
    def draw_boardareaarea(self):
        uc.werase(self.win_board)

        uc.box(self.win_boardarea, 0, 0)

        uc.wmove(self.win_boardarea, 1, 2)
        if self.on_menu:
            s = self.player.board.__str__()
        else:
            s = self.player.board.show_new_ship(self.new_ship_x,
                                                self.new_ship_y,
                                                self.menu[self.menu_hi].id,
                                                self.menu[self.menu_hi].length,
                                                self.new_ship_hor)

        for chr in s:
            if chr == '~':
                uc.wattron(self.win_board, uc.COLOR_PAIR(11))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(11))
            elif chr == 'O':
                uc.wattron(self.win_board, uc.COLOR_PAIR(12))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(12))
            elif chr == '#':
                uc.wattron(self.win_board, uc.COLOR_PAIR(13))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(13))
            else:
                uc.wattron(self.win_board, uc.COLOR_PAIR(12))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(12))

        uc.wrefresh(self.win_boardarea)
        uc.update_panels()
Exemplo n.º 8
0
 def _activate(self):
     box(self.button_window)
     mvwaddstr(self.button_window, ((self.height + 1) // 2) - 1,
               (self.width - len(self.name)) // 2 + 1, self.name)
     wbkgd(self.button_window, BLUE_WHITE)
     wrefresh(self.button_window)
     update_panels()
     doupdate()
Exemplo n.º 9
0
 def refresh(self):
     if self.enabled:
         for button in self.buttons:
             button.refresh()
         box(self.game_menu_interface_window)
         wrefresh(self.game_menu_interface_window)
         update_panels()
         doupdate()
Exemplo n.º 10
0
 def refresh_for_draw(self):
     self.building_zone_free = self.parent.game_interface.game.can_be_added(self.x - 1, self.y - 1)
     box(self.selector_zone, 0, 0)
     if self.building_zone_free:
         wbkgd(self.selector_zone, BLACK_GREEN)
     else:
         wbkgd(self.selector_zone, BLACK_RED)
     wrefresh(self.selector_zone)
Exemplo n.º 11
0
    def __init__(self):
        self.win = uc.newwin(10, 30, 0, 0)
        uc.box(self.win)
        uc.wmove(self.win, 1, 1)
        uc.waddstr(self.win, "Tile Info")

        panel = uc.new_panel(self.win)
        uc.move_panel(panel, glob.CAM_HEIGHT, 62)
Exemplo n.º 12
0
    def draw_title(self):
        offset_x = 2
        offset_y = 1

        uc.box(self.win_title, 0, 0)
        uc.wmove(self.win_title, offset_y, offset_x)
        uc.waddstr(self.win_title, self.title)
        uc.wrefresh(self.win_title)
Exemplo n.º 13
0
def win_show(win, label, label_color):
    starty, startx = uni.getbegyx(win)
    height, width = uni.getmaxyx(win)
    uni.box(win, 0, 0)
    uni.mvwaddch(win, 2, 0, uni.ACS_LTEE)
    uni.mvwhline(win, 2, 1, uni.ACS_HLINE, width - 2)
    uni.mvwaddch(win, 2, width - 1, uni.ACS_RTEE)
    print_in_middle(win, 1, 0, width, label, uni.COLOR_PAIR(label_color))
Exemplo n.º 14
0
 def refresh(self):
     if self.enabled:
         for button in self.buttons:
             button.refresh()
         box(self.game_menu_interface_window)
         wrefresh(self.game_menu_interface_window)
         update_panels()
         doupdate()
Exemplo n.º 15
0
 def refresh_for_draw(self):
     self.building_zone_free = self.parent.game_interface.game.can_be_added(
         self.x - 1, self.y - 1)
     box(self.selector_zone, 0, 0)
     if self.building_zone_free:
         wbkgd(self.selector_zone, BLACK_GREEN)
     else:
         wbkgd(self.selector_zone, BLACK_RED)
     wrefresh(self.selector_zone)
def win_show(win, label, label_color):
    starty, startx = uni.getbegyx(win)
    height, width = uni.getmaxyx(win)
    #starty, startx = (0, 0)
    # Box around window
    uni.box(win, 0, 0)
    # Connects header to box (left)
    uni.mvwaddch(win, 2, 0, uni.ACS_LTEE)
    # Header line
    uni.mvwhline(win, 2, 1, uni.ACS_HLINE, width - 2)
    # Connects header to box (right)
    uni.mvwaddch(win, 2, width - 1, uni.ACS_RTEE)
Exemplo n.º 17
0
def print_menu(menu_win, highlight):
    x = 2
    y = 2
    uni.box(menu_win, 0, 0)
    for i in range(0, n_choices):
        if (highlight == i + 1):
            uni.wattron(menu_win, uni.A_REVERSE)
            uni.mvwaddstr(menu_win, y, x, choices[i])
            uni.wattroff(menu_win, uni.A_REVERSE)
        else:
            uni.mvwaddstr(menu_win, y, x, choices[i])
        y += 1
    uni.wrefresh(menu_win)
Exemplo n.º 18
0
 def refresh(self):
     if self.enabled:
         x = 2
         y = 2
         box(self.game_stat_window, 0, 0)
         mvwaddstr(self.game_stat_window, y, x, " " * 127)
         if self.game_interface.game_initialized:
             for param in self.game_interface.game.player.strings_info:
                 wattron(self.game_stat_window, A_REVERSE)
                 mvwaddstr(self.game_stat_window, y, x, param, RED_WHITE)
                 wattroff(self.game_stat_window, A_REVERSE)
                 x += 5 + len(param)
         wrefresh(self.game_stat_window)
         update_panels()
         doupdate()
Exemplo n.º 19
0
 def refresh(self):
     if self.enabled:
         x = 2
         y = 2
         box(self.game_stat_window, 0, 0)
         mvwaddstr(self.game_stat_window, y, x, " " * 127)
         if self.game_interface.game_initialized:
             for param in self.game_interface.game.player.strings_info:
                 wattron(self.game_stat_window, A_REVERSE)
                 mvwaddstr(self.game_stat_window, y, x, param, RED_WHITE)
                 wattroff(self.game_stat_window, A_REVERSE)
                 x += 5 + len(param)
         wrefresh(self.game_stat_window)
         update_panels()
         doupdate()
Exemplo n.º 20
0
    def render_select_device_panel(self):
        win, rows, cols = self._init_render_window("select_device")
        uc.box(win)

        # Show the title of the context.
        title_start_row = 1
        self._render_text(win,
                          title_start_row,
                          2,
                          "Select a Player",
                          cols-3,
                          uc.A_BOLD)

        selected_i = self.state.select_device_menu.get_current_list().i
        self._render_list(win, self.state.select_device_menu["devices"], 3, rows-4, 2, cols-3, selected_i, self.is_active_window("select_device"))
Exemplo n.º 21
0
    def render(self):
        """Show the menubar."""
        #self.make_panels()
        # Box line
        uni.box(self.win, 0, 0)
        # Label
        self.draw_label()

        uni.doupdate()
        self.panel = uni.new_panel(self.win)
        uni.panel_above(self.panel)

        # Print submenu names
        self.update_section_atts()
        self.make_panels()
        for submenu in self.submenus:
            uni.mvwaddstr(self.win, 1, submenu.xpos, submenu.name)
Exemplo n.º 22
0
    def render_track_panel(self):
        win, rows, cols = self._init_render_window("tracks")

        # Draw border.
        uc.box(win)

        # Show the title of the context.
        title_start_row = 1
        self._render_text(win, title_start_row, 2,
                      self.state.main_menu['tracks'].header, cols-3, uc.A_BOLD)

        # Show the tracks.
        selected_i = self.state.main_menu['tracks'].i
        track_start_line = title_start_row + 2
        tracks = [track.str(cols-3) for track in self.state.main_menu['tracks']]
        self._render_list(win, tracks, track_start_line, rows-4,
                          2, cols-3, selected_i, self.is_active_window("tracks"))
Exemplo n.º 23
0
    def draw_board(self):
        uc.wclear(self.win_board)

        offset_x = 2
        offset_y = 1

        uc.box(self.win_boardarea, 0, 0)

        uc.wmove(self.win_boardarea, offset_y, offset_x)
        if self.on_menu:
            s = self.player.board.__str__()
        else:
            s = self.player.board.show_new_ship(self.new_ship_x,
                                                self.new_ship_y,
                                                self.menu[self.menu_hi].id,
                                                self.menu[self.menu_hi].length,
                                                self.new_ship_hor)

        uc.init_pair(11, uc.COLOR_BLUE, uc.COLOR_BLACK)
        uc.init_pair(12, uc.COLOR_WHITE, uc.COLOR_BLACK)
        uc.init_pair(13, uc.COLOR_RED, uc.COLOR_BLACK)

        for chr in s:
            if chr == '~':
                uc.wattron(self.win_board, uc.COLOR_PAIR(11))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(11))
            elif chr == 'O':
                uc.wattron(self.win_board, uc.COLOR_PAIR(12))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(12))
            elif chr == '#':
                uc.wattron(self.win_board, uc.COLOR_PAIR(13))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(13))
            else:
                uc.wattron(self.win_board, uc.COLOR_PAIR(12))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(12))

        uc.wbkgd(self.win_statusbar, uc.COLOR_PAIR(11))

        uc.wrefresh(self.win_boardarea)
        uc.update_panels()
Exemplo n.º 24
0
 def _refresh(self):
     x = 2
     y = 2
     box(self.menu_window, 0, 0)
     for i in range(0, len(self.topics)):
         if self.topics_pointer == i:
             wattron(self.menu_window, A_REVERSE)
             mvwaddstr(self.menu_window, y, x, self.topics[i])
             wattroff(self.menu_window, A_REVERSE)
         elif i in self.locked_topics:
             wattron(self.menu_window, A_UNDERLINE)
             mvwaddstr(self.menu_window, y, x, self.topics[i])
             wattroff(self.menu_window, A_UNDERLINE)
         else:
             mvwaddstr(self.menu_window, y, x, self.topics[i])
         y += 1
     wrefresh(self.menu_window)
     update_panels()
     doupdate()
Exemplo n.º 25
0
    def render_player_panel(self):
        win, rows, cols = self._init_render_window("player")

        # Draw border.
        uc.box(win)

        self._render_text(win, 1, 2, self.state.get_currently_playing_track().track, cols-3, uc.A_BOLD)
        self._render_text(win, 2, 2, self.state.get_currently_playing_track().album, cols-3, uc.A_BOLD)
        self._render_text(win, 3, 2, self.state.get_currently_playing_track().artist, cols-3, uc.A_BOLD)

        device_info = "{} ({}%)".format(self.state.current_device, self.state.volume)
        self._render_text(win, 7, 2, device_info, cols-3, uc.A_NORMAL)

        for i, action in enumerate(self.state.main_menu["player"]):
            if (i == self.state.main_menu['player'].i) and self.is_active_window("player"):
                style = uc.A_BOLD | uc.A_STANDOUT
            else:
                style = uc.A_NORMAL
            uc.mvwaddstr(win, 5, 2 + i*4, action.title, style)
Exemplo n.º 26
0
 def _refresh(self):
     x = 2
     y = 2
     box(self.menu_window, 0, 0)
     for i in range(0, len(self.topics)):
         if self.topics_pointer == i:
             wattron(self.menu_window, A_REVERSE)
             mvwaddstr(self.menu_window, y, x, self.topics[i])
             wattroff(self.menu_window, A_REVERSE)
         elif i in self.locked_topics:
             wattron(self.menu_window, A_UNDERLINE)
             mvwaddstr(self.menu_window, y, x, self.topics[i])
             wattroff(self.menu_window, A_UNDERLINE)
         else:
             mvwaddstr(self.menu_window, y, x, self.topics[i])
         y += 1
     wrefresh(self.menu_window)
     update_panels()
     doupdate()
Exemplo n.º 27
0
    def render(self):
        """Renders but does not show the widget."""
        # Draw the box line
        self.win = uni.newwin(self.height, self.width, self.ypos, self.xpos)
        if self.outline:
            uni.box(self.win, 0, 0)

        # Label
        self.draw_label()

        # Box fill
        # TODO: color fill

        # Write contents in order
        for line in self.content:
            ix = self.content.index(line) + 2
            uni.mvwaddstr(self.win, ix, 2, line)

        # Only create panel attribute on display
        self.panel = uni.new_panel(self.win)
Exemplo n.º 28
0
def get_messages():
    old_messages = ''
    while True:
        if kill_thread:
            break
        time.sleep(0.05)
        while True:
            try:
                sock = socket.socket()
                sock.connect((HOST, PORT))
                sock.sendall(bytes(channel + chr(0) + chr(2), "utf-8"))
                recvd = sock.recv(1024).decode().split('||')
                count = recvd[0]
                users = recvd[1].split('|')
                ctypes.windll.kernel32.SetConsoleTitleA(bytes(channel + ": " + str(count) + " user(s) online", "utf-8"))
                u.wclear(people_win)
                u.box(people_win)
                i = 1
                u.mvwaddstr(people_win, i, 1, ' Users in #%s:' % channel)
                for user in users:
                    i += 1
                    u.mvwaddstr(people_win, i, 1, '  - ' + user)
                u.wrefresh(people_win)
                sock = socket.socket()
                sock.connect((HOST, PORT))
                break
            except (ConnectionRefusedError, ConnectionResetError):
                u.mvwaddstr(chat_win, 1, 1, "Can't connect.")
                time.sleep(1)
        sock.sendall(bytes(channel + chr(0) + chr(1), "utf-8"))
        incoming_messages = str(sock.recv(4096), "utf-8")
        if not incoming_messages == old_messages:
            i = 0
            u.wclear(chat_win)
            draw_boxes()
            for message in get_latest(incoming_messages.split('\n')):
                i += 1
                u.mvwaddstr(chat_win, i, 1, message[:78])
            u.wrefresh(chat_win)
            old_messages = incoming_messages
        time.sleep(0.1)
Exemplo n.º 29
0
    def close(self):
        prompt_start_x = self.max_x // 2 - 19
        prompt_start_y = self.max_y // 3

        if prompt_start_x < 1:
            prompt_start_x = 1
        if prompt_start_y < 1:
            prompt_start_y = 1

        win_prompt = uc.newwin(3, 38, prompt_start_y, prompt_start_x)
        uc.box(win_prompt, 0, 0)
        uc.mvwaddstr(win_prompt, 1, 1, 'Do you want to close the game? (y|n)')
        uc.wbkgd(win_prompt, uc.COLOR_PAIR(1))
        uc.wrefresh(win_prompt)

        answer = uc.wgetch(stdscr)
        if answer == ord('y') or answer == ord('Y'):
            uc.endwin()
            exit()
        else:
            uc.delwin(win_prompt)
Exemplo n.º 30
0
    def render_search_panel(self):
        win, rows, cols = self._init_render_window("search_results")
        uc.box(win)
        n_display_cols = cols - 4

        # Show the title of the context.
        title_start_row = 1
        self._render_text(win,
                          title_start_row, 2,
                          self.state.search_menu["search_results"].header,
                          n_display_cols, uc.A_BOLD)

        # Show the results.
        results = [r.str(n_display_cols) for r in self.state.search_menu["search_results"]]
        selected_i = self.state.search_menu.get_current_list().i
        self._render_list(win,
                          results,
                          3, rows-4,
                          2, n_display_cols,
                          selected_i,
                          self.is_active_window("search_results"))
Exemplo n.º 31
0
    def draw_shipmenu(self):
        uc.wclear(self.win_shipmenu)

        offset_x = 2
        offset_y = 1

        uc.box(self.win_shipmenu, 0, 0)
        uc.wmove(self.win_shipmenu, offset_y, offset_x)
        uc.waddstr(self.win_shipmenu, 'ship menu:')
        offset_y += 2

        for ele in self.menu:
            if (self.on_menu and self.menu_hi == self.menu.index(ele)):
                uc.wattron(self.win_shipmenu, uc.A_REVERSE)
                uc.mvwaddstr(self.win_shipmenu, offset_y, offset_x, ele)
                uc.wattroff(self.win_shipmenu, uc.A_REVERSE)
                offset_y += 2
            else:
                uc.mvwaddstr(self.win_shipmenu, offset_y, offset_x, ele)
                offset_y += 2

        uc.wrefresh(self.win_shipmenu)
Exemplo n.º 32
0
    def render_user_panel(self):
        win, rows, cols = self._init_render_window("user")

        # Draw border.
        uc.box(win)

        # Show the display_name.
        title_start_line = 1
        self._render_text(win, title_start_line, 2,
                          "[Spotify Terminal]",
                          cols-3,
                          uc.A_BOLD,
                          centered=True)

        # Show the display_name.
        display_name_start_line = title_start_line + 1
        self._render_text(win, display_name_start_line, 2,
                          self.state.get_display_name(),
                          cols-3,
                          uc.A_BOLD,
                          centered=True)

        # Bar.
        self._render_text(win, display_name_start_line+1, 1,
                          "_"*cols,
                          cols-2,
                          uc.A_NORMAL)

        # Show the playlists.
        playlists = [str(playlist) for playlist in self.state.main_menu['user']]
        selected_i = self.state.main_menu["user"].i
        playlist_start_line = display_name_start_line + 2
        self._render_list(win,
                          playlists,
                          playlist_start_line, rows-(playlist_start_line+1),
                          2, cols-3,
                          selected_i,
                          self.is_active_window("user"))
uni.noecho()
uni.keypad(stdscr, True)
uni.curs_set(0)

uni.start_color()

# Sub window
# Max coords of parent window
maxy, maxx = uni.getmaxyx(stdscr)
menu_height = 3
menu = uni.newwin(menu_height, maxx, 0, 0)
starty, startx = uni.getbegyx(menu)
height, width = uni.getmaxyx(menu)

# Box line
uni.box(menu, 0, 0)
#uni.bkgd(uni.COLOR_PAIR(1))

# Box label

#uni.wattron(menu, uni.COLOR_PAIR(0))
#uni.mvwaddstr(menu, 0, 2, "Garin")
uni.mvwaddstr(menu, 1, 1, "File")
uni.mvwaddstr(menu, 1, len("File") + 2, "Edit")
#uni.wattroff(menu, uni.COLOR_PAIR(0))
uni.refresh()

#uni.bkgd(uni.COLOR_PAIR(1))

#win_show(my_wins[0], label, 0)
Exemplo n.º 34
0
 def draw_title(self):
     uc.box(self.win_title, 0, 0)
     uc.wmove(self.win_title, 1, 2)
     uc.waddstr(self.win_title, self.str_title)
     uc.wrefresh(self.win_title)
Exemplo n.º 35
0
 def create_win(self):
     local_win = derwin(self.parent_window, self.height, self.width, self.y, self.x)
     box(local_win, 0, 0)
     wrefresh(local_win)
     self.selector_zone = local_win
Exemplo n.º 36
0
 def refresh(self):
     self.background_change()
     box(self.button_window)
     wrefresh(self.button_window)
Exemplo n.º 37
0
 def refresh(self):
     self.background_change()
     box(self.button_window)
     wrefresh(self.button_window)
Exemplo n.º 38
0
def draw_boxes():
    u.box(chat_win)
    u.box(input_win)
    u.box(people_win)
Exemplo n.º 39
0
    def __init__(self):
        self.turn =1
        
        #Create debugging display
        debug_win = uc.newwin(15, 30, 0, 0)
        uc.box(debug_win)
        uc.wmove(debug_win, 1, 1)
        uc.waddstr(debug_win, "Debug:")
        uc.wmove(debug_win, 2, 1)

        debug_pnl = uc.new_panel(debug_win)
        uc.move_panel(debug_pnl, glob.CAM_HEIGHT, 32)

        #Generate the world
        self.world = Map(glob.N_HEX_ROWS, glob.N_HEX_COLS, debug_win)

        #map_height: 3 + 2*(rows-1) + 2 for border
        #map_width: 5 + 4*cols + 2 for border
        map_win = uc.newwin(glob.CAM_HEIGHT, glob.CAM_WIDTH, 0, 0)


        self.painter = Painter(glob.N_HEX_ROWS, glob.N_HEX_COLS, map_win)
        self.painter.updateAllTiles(self.world)

        #Put world window into a panel
        map_pnl = uc.new_panel(map_win)
        uc.move_panel(map_pnl, 1, 1)

        uc.top_panel(debug_pnl)

        self.status_win = uc.newwin(10, 30, 0, 0)
        uc.box(self.status_win)
        uc.wmove(self.status_win, 1, 1)
        uc.waddstr(self.status_win, "Turn " + str(self.turn))

        status_pnl = uc.new_panel(self.status_win)
        uc.move_panel(status_pnl, glob.CAM_HEIGHT, 2)

        self.tile_window = TileWindow()

        self.painter.drawWindow()
        showChanges()

        
        
        #input loop
        while True:
            sys.stdout.flush()
            ch = uc.getch()
            uc.waddstr(debug_win, str(ch))
            #Exit Key
            if ch == Key.ESC:
                break
            #Movement Keys
            elif ch == Key.E:
                self.movePlayer(HexDir.UL)
            elif ch == Key.R:
                self.movePlayer(HexDir.UR)
            elif ch == Key.S:
                self.movePlayer(HexDir.L)
            elif ch == Key.G:
                self.movePlayer(HexDir.R)
            elif ch == Key.D:
                self.movePlayer(HexDir.DL)
            elif ch == Key.F:
                self.movePlayer(HexDir.DR)
            #End Turn Key
            elif ch == Key.SPACE:
                self.incrementTurn()
            #Camera Scrolling Keys
            #TBD: Remaining order checks
            elif ch == uc.KEY_UP:
                self.painter.moveCamera(0, -1*glob.CAM_SPEED)
            elif ch == uc.KEY_DOWN:
                self.painter.moveCamera(0, glob.CAM_SPEED)
            elif ch == uc.KEY_LEFT:
                self.painter.moveCamera(-1*glob.CAM_SPEED, 0)
            elif ch == uc.KEY_RIGHT:
                self.painter.moveCamera(glob.CAM_SPEED, 0)
            #Toggle drawing borders
            elif ch == Key.B:
                self.painter.draw_borders = not self.painter.draw_borders
                self.painter.updateAllTileBorders(self.world)
                self.painter.drawWindow()
Exemplo n.º 40
0
 def create_win(self):
     local_win = derwin(self.parent_window, self.height, self.width, self.y,
                        self.x)
     box(local_win, 0, 0)
     wrefresh(local_win)
     self.selector_zone = local_win