def render(self, console):
        if self.time_alive > self.lifespan:
            self.stop()

        if (self.direction == VerticalWipeDirection.DOWN):
            self.current_wipe_height += self.speed * self.engine.get_delta_time(
            )
        elif (self.direction == VerticalWipeDirection.UP):
            self.current_wipe_height -= self.speed * self.engine.get_delta_time(
            )

        temp_console = Console(width=self.width, height=self.height, order="F")

        for x in range(0, self.width):
            for y in range(0, self.height):
                temp_console.tiles_rgb[x, y] = self.tiles[x, y]

        temp_console.blit(console,
                          src_x=self.x,
                          src_y=self.y,
                          dest_x=0,
                          dest_y=0 + int(self.current_wipe_height),
                          width=self.width,
                          height=self.height - int(self.current_wipe_height))

        self.time_alive += 0.16
Example #2
0
    def render(self, console):

        columns_finished = True

        for col in range(0, self.width):
            if self.time_alive > self.col_trigger_times[col]:
                self.current_wipe_heights[col] += self.height / self.lifespan

            if self.current_wipe_heights[col] < self.height:
                columns_finished = False

            temp_console = Console(width=1, height=self.height, order="F")

            for y in range(0, self.height):
                temp_console.tiles_rgb[0, y] = self.tiles[col, y]

            temp_console.blit(console,
                              src_x=0,
                              src_y=0,
                              dest_x=col,
                              dest_y=int(self.current_wipe_heights[col]),
                              width=1,
                              height=self.height -
                              int(self.current_wipe_heights[col]))

        self.time_alive += 0.16
        if columns_finished == True:
            self.stop()
Example #3
0
    def render(self, console: Console):
        temp_console = Console(self.width, self.height)

        for w in range(0, self.width):
            for h in range(0, self.height):
                if self.tiles[w, h][0] != 9488:
                    if self.mouseover:
                        self.tiles[w, h][1] = self.highlight_bg
                    else:
                        self.tiles[w, h][1] = self.normal_bg

                temp_console.tiles_rgb[h, w] = self.tiles[w, h]

        temp_console.blit(console, self.x, self.y)
Example #4
0
    def render(self, console: Console):
        temp_console = Console(width=self.width, height=self.height)
        for w in range(0, self.width):
            if w < len(self.text):
                temp_console.tiles_rgb[0, w] = (ord(self.text[w]),
                                                self.fg_colour, self.bg_colour)
            else:
                temp_console.tiles_rgb[0, w] = (ord(' '), self.fg_colour,
                                                self.bg_colour)

        if self.selected == True:
            if self.blink == True:
                temp_console.tiles_rgb[0,
                                       len(self.text)] = (9488, self.fg_colour,
                                                          self.bg_colour)

        temp_console.blit(console, self.x, self.y)
Example #5
0
    def render(self, console: Console):
        """Renders the highlighted slection to the screen. """
        temp_console = Console(width=console.width,
                               height=console.height,
                               order="F")

        for tile in self.tiles:
            temp_console.tiles_rgb[tile[0][0],
                                   tile[0][1]] = (ord(" "), (255, 255, 255),
                                                  tile[1])
            temp_console.blit(console,
                              src_x=tile[0][0],
                              src_y=tile[0][1],
                              dest_x=tile[0][0],
                              dest_y=tile[0][1],
                              width=1,
                              height=1)
Example #6
0
    def render(self, console):
        if self.time_alive > self.lifespan:
            self.stop()

        if (self.direction == HorizontalWipeDirection.LEFT):
            self.current_wipe_length -= 0.7
        elif (self.direction == HorizontalWipeDirection.RIGHT):
            self.current_wipe_length += 0.7

        temp_console = Console(width=self.width, height=self.height, order="F")

        for x in range(0, self.width):
            for y in range(0, self.height):
                temp_console.tiles_rgb[x, y] = self.tiles[x, y]

        temp_console.blit(console,
                          src_x=int(self.current_wipe_length),
                          src_y=0,
                          dest_x=self.x + int(self.current_wipe_length),
                          dest_y=self.y,
                          width=self.width,
                          height=self.height)

        self.time_alive += 0.16
Example #7
0
    def on_render(self, console: tcod.Console) -> None:
        super().on_render(console)  # Draw the main state as the background.

        log_console = Console(console.width - 6, console.height - 6)

        # Draw the frame with a custom banner title
        log_console.draw_frame(0, 0, log_console.width, log_console.height)
        log_console.print_box(0,
                              0,
                              log_console.width,
                              1,
                              "-|Message History|-",
                              alignment=tcod.CENTER)

        # Render the message log using the cursor param
        self.engine.message_log.render_messages(
            log_console,
            1,
            1,
            log_console.width - 2,
            log_console.height - 2,
            self.engine.message_log.messages[:self.cursor + 1],
        )
        log_console.blit(console, 3, 3)