Пример #1
0
    def remap(self, codepoint: int, x: int, y: int = 0) -> None:
        """Reassign a codepoint to a character in this tileset.

        `codepoint` is the Unicode codepoint to assign.

        `x` and `y` is the position of the tilesheet to assign to `codepoint`.
        This is the tile position itself, not the pixel position of the tile.
        Large values of `x` will wrap to the next row, so using `x` by itself
        is equivalent to `Tile Index` in the :any:`charmap-reference`.

        This is normally used on loaded tilesheets.  Other methods of Tileset
        creation won't have reliable tile indexes.

        .. versionadded:: 11.12
        """
        tile_i = x + y * self._tileset_p.virtual_columns
        if not (0 <= tile_i < self._tileset_p.tiles_count):
            raise IndexError("Tile %i is non-existent and can't be assigned."
                             " (Tileset has %i tiles.)" %
                             (tile_i, self._tileset_p.tiles_count))
        _check(
            lib.TCOD_tileset_assign_tile(
                self._tileset_p,
                tile_i,
                codepoint,
            ))
Пример #2
0
    def remap(self, codepoint: int, x: int, y: int = 0) -> None:
        """Reassign a codepoint to a character in this tileset.

        `codepoint` is the Unicode codepoint to assign.

        `x` and `y` is the position on the tilesheet to assign to `codepoint`.
        Large values of `x` will wrap to the next row, so `y` isn't necessary
        if you think of the tilesheet as a 1D array.

        This is normally used on loaded tilesheets.  Other methods of Tileset
        creation won't have reliable tile indexes.

        .. versionadded:: 11.12
        """
        tile_i = x + y * self._tileset_p.virtual_columns
        if not (0 <= tile_i < self._tileset_p.tiles_count):
            raise IndexError("Tile %i is non-existent and can't be assigned."
                             " (Tileset has %i tiles.)" %
                             (tile_i, self._tileset_p.tiles_count))
        _check(
            lib.TCOD_tileset_assign_tile(
                self._tileset_p,
                tile_i,
                codepoint,
            ))
Пример #3
0
    def remap(self, codepoint: int, x: int, y: int = 0) -> None:
        """Reassign a codepoint to a character in this tileset.

        `codepoint` is the Unicode codepoint to assign.

        `x` and `y` is the position on the tilesheet to assign to `codepoint`.
        Large values of `x` will wrap to the next row, so `y` isn't necessary
        if you think of the tilesheet as a 1D array.

        This is normally used on loaded tilesheets.  Other methods of Tileset
        creation won't have reliable tile indexes.

        .. versionadded:: 11.12
        """
        _check(
            lib.TCOD_tileset_assign_tile(
                self._tileset_p,
                codepoint,
                x + y * self._tileset_p.virtual_columns,
            ))