Exemplo n.º 1
0
    def _draw_background(self, painter: QPainter, level: Level):
        painter.save()

        bg_color = bg_color_for_object_set(level.object_set_number, level.header.object_palette_index)

        painter.fillRect(level.get_rect(self.block_length), bg_color)

        painter.restore()
Exemplo n.º 2
0
    def _draw_background(self, painter: QPainter, level: Level):
        painter.save()

        if level.object_set_number == CLOUDY_OBJECT_SET:
            bg_color = QColor(
                *NESPalette[load_palette_group(level.object_set_number, level.header.object_palette_index)[3][2]]
            )
        else:
            bg_color = bg_color_for_object_set(level.object_set_number, level.header.object_palette_index)

        painter.fillRect(level.get_rect(self.block_length), bg_color)

        painter.restore()
Exemplo n.º 3
0
    def _draw_grid(self, painter: QPainter, level: Level):
        panel_width, panel_height = level.get_rect(self.block_length).size().toTuple()

        painter.setPen(self.grid_pen)

        for x in range(0, panel_width, self.block_length):
            painter.drawLine(x, 0, x, panel_height)
        for y in range(0, panel_height, self.block_length):
            painter.drawLine(0, y, panel_width, y)

        painter.setPen(self.screen_pen)

        if level.is_vertical:
            for y in range(0, panel_height, self.block_length * SCREEN_HEIGHT):
                painter.drawLine(0, y, panel_width, y)
        else:
            for x in range(0, panel_width, self.block_length * SCREEN_WIDTH):
                painter.drawLine(x, 0, x, panel_height)