def __init__( self, draw_area: Widget, bma: Union[BmaProtocol, None], bpa_durations: int, pal_ani_durations: int, # chunks_surfaces[layer_number][chunk_idx][palette_animation_frame][frame] chunks_surfaces: Iterable[Iterable[Iterable[Iterable[cairo.Surface]]]] ): """ Initialize a drawer... :param draw_area: Widget to draw on. :param bma: Either a BMA with tile indexes or None, has to be set manually then for drawing :param bpa_durations: How many frames to hold a BPA animation tile :param chunks_surfaces: Bg controller format chunk surfaces """ self.draw_area = draw_area self.reset(bma, bpa_durations, pal_ani_durations, chunks_surfaces) self.draw_chunk_grid = False self.draw_tile_grid = False self.use_pink_bg = False # Interaction self.interaction_mode = DrawerInteraction.NONE self.interaction_chunks_selected_id = 0 self.interaction_col_solid = False self.interaction_dat_value = 0 self.mouse_x = 99999 self.mouse_y = 99999 self.edited_layer = -1 self.edited_collision = -1 self.show_only_edited_layer = False self.dim_layers = False self.draw_collision1 = False self.draw_collision2 = False self.draw_data_layer = False self.selection_plugin = SelectionDrawerPlugin( BPC_TILE_DIM, BPC_TILE_DIM, self.selection_draw_callback) self.tile_grid_plugin = GridDrawerPlugin(BPC_TILE_DIM, BPC_TILE_DIM) self.chunk_grid_plugin = GridDrawerPlugin( BPC_TILE_DIM * self.tiling_width, BPC_TILE_DIM * self.tiling_height, color=(0.15, 0.15, 0.15, 0.25)) self.scale = 1 self.drawing_is_active = False
def __init__( self, draw_area: Gtk.Widget, markers: List[MapMarkerPlacement], cb_dungeon_name: Callable[[int], str], scale: int ): self.draw_area = draw_area self.markers: List[MapMarkerPlacement] = markers self.markers_at_pos: Dict[Tuple[int, int], List[MapMarkerPlacement]] = {} self.map_bg = None self.level_id = None self.draw_tile_grid = True self._cb_dungeon_name = cb_dungeon_name # Interaction self.mouse_x = 99999 self.mouse_y = 99999 self._selected: Optional[MapMarkerPlacement] = None self._editing = None self._editing_pos = None self._hide = None self.tile_grid_plugin = GridDrawerPlugin( BPC_TILE_DIM, BPC_TILE_DIM, color=(0.2, 0.2, 0.2, 0.1) ) self.scale = scale self.drawing_is_active = False
def __init__( self, draw_area: Widget, dbg: Union[Dbg, None], pal_ani_durations: int, # chunks_surfaces[chunk_idx][palette_animation_frame][frame] chunks_surfaces: Iterable[Iterable[List[cairo.Surface]]]): """ Initialize a drawer... :param draw_area: Widget to draw on. :param dbg: Either a DBG with chunk indexes or None, has to be set manually then for drawing :param chunks_surfaces: Bg controller format chunk surfaces """ self.draw_area = draw_area self.reset(dbg, pal_ani_durations, chunks_surfaces) self.draw_chunk_grid = True self.draw_tile_grid = True self.use_pink_bg = False # Interaction self.interaction_chunks_selected_id = 0 self.mouse_x = 99999 self.mouse_y = 99999 self.tiling_width = DBG_TILING_DIM self.tiling_height = DBG_TILING_DIM self.width_in_chunks = DBG_WIDTH_AND_HEIGHT self.height_in_chunks = DBG_WIDTH_AND_HEIGHT self.width_in_tiles = DBG_WIDTH_AND_HEIGHT * 3 self.height_in_tiles = DBG_WIDTH_AND_HEIGHT * 3 self.selection_plugin = SelectionDrawerPlugin( DPCI_TILE_DIM, DPCI_TILE_DIM, self.selection_draw_callback) self.tile_grid_plugin = GridDrawerPlugin(DPCI_TILE_DIM, DPCI_TILE_DIM) self.chunk_grid_plugin = GridDrawerPlugin( DPCI_TILE_DIM * self.tiling_width, DPCI_TILE_DIM * self.tiling_height, color=(0.15, 0.15, 0.15, 0.25)) self.scale = 1 self.drawing_is_active = False
def set_tileset_renderer(self, renderer: AbstractTilesetRenderer): self.tileset_renderer = renderer self.selection_plugin = SelectionDrawerPlugin( self.tileset_renderer.chunk_dim(), self.tileset_renderer.chunk_dim(), self.selection_draw_callback ) self.tile_grid_plugin = GridDrawerPlugin( self.tileset_renderer.chunk_dim(), self.tileset_renderer.chunk_dim(), offset_x=self.tileset_renderer.chunk_dim() * OFFSET_BASE, offset_y=self.tileset_renderer.chunk_dim() * OFFSET_BASE )
def __init__(self, draw_area: Gtk.Widget, ssa: Ssa, cb_trigger_label: Callable[[int], str], sprite_provider: SpriteProvider): self.draw_area = draw_area self.ssa = ssa self.map_bg = None self.position_marks: List[SourceMapPositionMark] = [] self.draw_tile_grid = False # Interaction self.interaction_mode = InteractionMode.SELECT self.mouse_x = 99999 self.mouse_y = 99999 self.sprite_provider = sprite_provider self._cb_trigger_label = cb_trigger_label self._sectors_visible = [ True for _ in range(0, len(self.ssa.layer_list)) ] self._sectors_solo = [ False for _ in range(0, len(self.ssa.layer_list)) ] self._sector_highlighted = None self._selected: Optional[Union[SsaActor, SsaObject, SsaPerformer, SsaEvent, SourceMapPositionMark]] = None # If not None, drag is active and value is coordinate self._selected__drag: Optional[Tuple[int, int]] = None self._edit_pos_marks = False self.selection_plugin = SelectionDrawerPlugin( BPC_TILE_DIM, BPC_TILE_DIM, self.selection_draw_callback) self.tile_grid_plugin = GridDrawerPlugin(BPC_TILE_DIM, BPC_TILE_DIM, offset_x=-BPC_TILE_DIM / 2, offset_y=-BPC_TILE_DIM / 2) self.scale = 1 self.drawing_is_active = False
def __init__( self, draw_area: Gtk.Widget, fixed_floor: FixedFloor, sprite_provider: SpriteProvider, entity_rule_container: EntityRuleContainer, string_provider: StringProvider ): self.draw_area = draw_area self.fixed_floor = fixed_floor self.tileset_renderer: Optional[AbstractTilesetRenderer] = None self.draw_tile_grid = False self.info_layer_active = None self.entity_rule_container = entity_rule_container # Interaction self.interaction_mode = InteractionMode.SELECT self.mouse_x = 99999 self.mouse_y = 99999 self.sprite_provider = sprite_provider self.string_provider = string_provider # Depending on the mode this is either a coordinate tuple or a FixedFloorActionRule to place. self._selected: Optional[Union[Tuple[int, int], FixedFloorActionRule]] = None self._selected__drag = None self.selection_plugin = SelectionDrawerPlugin( DPCI_TILE_DIM * DPC_TILING_DIM, DPCI_TILE_DIM * DPC_TILING_DIM, self.selection_draw_callback ) self.tile_grid_plugin = GridDrawerPlugin( DPCI_TILE_DIM * DPC_TILING_DIM, DPCI_TILE_DIM * DPC_TILING_DIM, offset_x=OFFSET, offset_y=OFFSET ) self.scale = 1 self.drawing_is_active = False