Beispiel #1
0
    def __init__(
        self,
        draw_area: Widget,
        tile_mappings: Union[None, List[TilemapEntry]],
        bpa_durations: int,
        pal_ani_durations: int,
        # Format: tile_surfaces[pal][tile_idx][pal_frame][frame]
        tile_surfaces: List[List[List[List[cairo.Surface]]]]):
        """

        :param draw_area: Widget to draw on
        :param tile_mappings: Either one tile or 3x3 tiles to draw. Can also be set later
        :param bpa_durations:
        :param tile_surfaces: List of all surfaces
        """
        self.draw_area = draw_area

        self.tile_mappings = tile_mappings

        self.tiling_width = 3
        self.tiling_height = 3

        if tile_mappings:
            self.set_tile_mappings(tile_mappings)

        self.animation_context = AnimationContext(tile_surfaces, bpa_durations,
                                                  pal_ani_durations)

        self.scale = 1

        self.drawing_is_active = False
Beispiel #2
0
    def reset(self, bma, bpa_durations, pal_ani_durations, chunks_surfaces):
        self.reset_bma(bma)

        self.animation_context = AnimationContext(chunks_surfaces,
                                                  bpa_durations,
                                                  pal_ani_durations)
        self._tileset_drawer_overlay: Optional[MapTilesetOverlay] = None
Beispiel #3
0
    def reset(self, bma, bpa_durations, pal_ani_durations, chunks_surfaces):
        if isinstance(bma, Bma):
            self.tiling_width = bma.tiling_width
            self.tiling_height = bma.tiling_height
            self.mappings = [bma.layer0, bma.layer1]
            self.width_in_chunks = bma.map_width_chunks
            self.height_in_chunks = bma.map_height_chunks
            self.width_in_tiles = bma.map_width_camera
            self.height_in_tiles = bma.map_height_camera
            self.collision1 = bma.collision
            self.collision2 = bma.collision2
            self.data_layer = bma.unknown_data_block
        else:
            self.tiling_width = 3
            self.tiling_height = 3
            self.mappings = [[], []]
            self.width_in_chunks = 1
            self.height_in_chunks = 1
            self.width_in_tiles = None
            self.height_in_tiles = None
            self.collision1 = None
            self.collision2 = None
            self.data_layer = None

        self.animation_context = AnimationContext(chunks_surfaces,
                                                  bpa_durations,
                                                  pal_ani_durations)
    def reset(self, dbg, pal_ani_durations, chunks_surfaces):
        if isinstance(dbg, Dbg):
            self.mappings = dbg.mappings
        else:
            self.mappings = []

        self.animation_context = AnimationContext([chunks_surfaces], 0,
                                                  pal_ani_durations)
Beispiel #5
0
 def reset_surfaces(self, chunks_surfaces):
     self.animation_context = AnimationContext([chunks_surfaces], 1, self.pal_ani_durations)