Documentation
¶
Overview ¶
Package TileSetAtlasSource provides methods for working with TileSetAtlasSource object instances.
Index ¶
- Constants
- type Advanced
- type Any
- type Expanded
- func (self Expanded) CreateAlternativeTile(atlas_coords Vector2i.XY, alternative_id_override int) int
- func (self Expanded) CreateTile(atlas_coords Vector2i.XY, size Vector2i.XY)
- func (self Expanded) GetTileTextureRegion(atlas_coords Vector2i.XY, frame_ int) Rect2i.PositionSize
- func (self Expanded) HasRoomForTile(atlas_coords Vector2i.XY, size Vector2i.XY, animation_columns int, ...) bool
- func (self Expanded) MoveTileInAtlas(atlas_coords Vector2i.XY, new_atlas_coords Vector2i.XY, new_size Vector2i.XY)
- type Extension
- type ID
- type Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) AsTileSetAtlasSource() Instance
- func (self Instance) AsTileSetSource() TileSetSource.Instance
- func (self Instance) ClearTilesOutsideTexture()
- func (self Instance) CreateAlternativeTile(atlas_coords Vector2i.XY) int
- func (self Instance) CreateTile(atlas_coords Vector2i.XY)
- func (self Instance) GetAtlasGridSize() Vector2i.XY
- func (self Instance) GetNextAlternativeTileId(atlas_coords Vector2i.XY) int
- func (self Instance) GetRuntimeTexture() Texture2D.Instance
- func (self Instance) GetRuntimeTileTextureRegion(atlas_coords Vector2i.XY, frame_ int) Rect2i.PositionSize
- func (self Instance) GetTileAnimationColumns(atlas_coords Vector2i.XY) int
- func (self Instance) GetTileAnimationFrameDuration(atlas_coords Vector2i.XY, frame_index int) Float.X
- func (self Instance) GetTileAnimationFramesCount(atlas_coords Vector2i.XY) int
- func (self Instance) GetTileAnimationMode(atlas_coords Vector2i.XY) TileAnimationMode
- func (self Instance) GetTileAnimationSeparation(atlas_coords Vector2i.XY) Vector2i.XY
- func (self Instance) GetTileAnimationSpeed(atlas_coords Vector2i.XY) Float.X
- func (self Instance) GetTileAnimationTotalDuration(atlas_coords Vector2i.XY) Float.X
- func (self Instance) GetTileAtCoords(atlas_coords Vector2i.XY) Vector2i.XY
- func (self Instance) GetTileData(atlas_coords Vector2i.XY, alternative_tile int) TileData.Instance
- func (self Instance) GetTileSizeInAtlas(atlas_coords Vector2i.XY) Vector2i.XY
- func (self Instance) GetTileTextureRegion(atlas_coords Vector2i.XY) Rect2i.PositionSize
- func (self Instance) GetTilesToBeRemovedOnChange(texture Texture2D.Instance, margins Vector2i.XY, separation Vector2i.XY, ...) []Vector2.XY
- func (self Instance) HasRoomForTile(atlas_coords Vector2i.XY, size Vector2i.XY, animation_columns int, ...) bool
- func (self Instance) HasTilesOutsideTexture() bool
- func (self Instance) ID() ID
- func (self Instance) Margins() Vector2i.XY
- func (self Instance) MoveTileInAtlas(atlas_coords Vector2i.XY)
- func (self Instance) RemoveAlternativeTile(atlas_coords Vector2i.XY, alternative_tile int)
- func (self Instance) RemoveTile(atlas_coords Vector2i.XY)
- func (self Instance) Separation() Vector2i.XY
- func (self Instance) SetAlternativeTileId(atlas_coords Vector2i.XY, alternative_tile int, new_id int)
- func (self Instance) SetMargins(value Vector2i.XY)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetSeparation(value Vector2i.XY)
- func (self Instance) SetTexture(value Texture2D.Instance)
- func (self Instance) SetTextureRegionSize(value Vector2i.XY)
- func (self Instance) SetTileAnimationColumns(atlas_coords Vector2i.XY, frame_columns int)
- func (self Instance) SetTileAnimationFrameDuration(atlas_coords Vector2i.XY, frame_index int, duration Float.X)
- func (self Instance) SetTileAnimationFramesCount(atlas_coords Vector2i.XY, frames_count int)
- func (self Instance) SetTileAnimationMode(atlas_coords Vector2i.XY, mode TileAnimationMode)
- func (self Instance) SetTileAnimationSeparation(atlas_coords Vector2i.XY, separation Vector2i.XY)
- func (self Instance) SetTileAnimationSpeed(atlas_coords Vector2i.XY, speed Float.X)
- func (self Instance) SetUseTexturePadding(value bool)
- func (self Instance) Texture() Texture2D.Instance
- func (self Instance) TextureRegionSize() Vector2i.XY
- func (self Instance) UseTexturePadding() bool
- func (self Instance) Virtual(name string) reflect.Value
- type TileAnimationMode
Constants ¶
const TransformFlipH = 4096 //gd:TileSetAtlasSource.TRANSFORM_FLIP_H
const TransformFlipV = 8192 //gd:TileSetAtlasSource.TRANSFORM_FLIP_V
const TransformTranspose = 16384 //gd:TileSetAtlasSource.TRANSFORM_TRANSPOSE
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Expanded ¶
type Expanded [1]gdclass.TileSetAtlasSource
func (Expanded) CreateAlternativeTile ¶
func (self Expanded) CreateAlternativeTile(atlas_coords Vector2i.XY, alternative_id_override int) int
Creates an alternative tile for the tile at coordinates [param atlas_coords]. If [param alternative_id_override] is -1, give it an automatically generated unique ID, or assigns it the given ID otherwise. Returns the new alternative identifier, or -1 if the alternative could not be created with a provided [param alternative_id_override].
func (Expanded) CreateTile ¶
Creates a new tile at coordinates [param atlas_coords] with the given [param size].
func (Expanded) GetTileTextureRegion ¶
Returns a tile's texture region in the atlas texture. For animated tiles, a [param frame] argument might be provided for the different frames of the animation.
func (Expanded) HasRoomForTile ¶
func (self Expanded) HasRoomForTile(atlas_coords Vector2i.XY, size Vector2i.XY, animation_columns int, animation_separation Vector2i.XY, frames_count int, ignored_tile Vector2i.XY) bool
Returns whether there is enough room in an atlas to create/modify a tile with the given properties. If [param ignored_tile] is provided, act as is the given tile was not present in the atlas. This may be used when you want to modify a tile's properties.
func (Expanded) MoveTileInAtlas ¶
func (self Expanded) MoveTileInAtlas(atlas_coords Vector2i.XY, new_atlas_coords Vector2i.XY, new_size Vector2i.XY)
Move the tile and its alternatives at the [param atlas_coords] coordinates to the [param new_atlas_coords] coordinates with the [param new_size] size. This functions will fail if a tile is already present in the given area. If [param new_atlas_coords] is [code]Vector2i(-1, -1)[/code], keeps the tile's coordinates. If [param new_size] is [code]Vector2i(-1, -1)[/code], keeps the tile's size. To avoid an error, first check if a move is possible using [method has_room_for_tile].
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResource ¶
func (*Extension[T]) AsTileSetAtlasSource ¶
func (*Extension[T]) AsTileSetSource ¶
func (self *Extension[T]) AsTileSetSource() TileSetSource.Instance
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.TileSetAtlasSource
An atlas is a grid of tiles laid out on a texture. Each tile in the grid must be exposed using [method create_tile]. Those tiles are then indexed using their coordinates in the grid. Each tile can also have a size in the grid coordinates, making it more or less cells in the atlas. Alternatives version of a tile can be created using [method create_alternative_tile], which are then indexed using an alternative ID. The main tile (the one in the grid), is accessed with an alternative ID equal to 0. Each tile alternate has a set of properties that is defined by the source's [TileSet] layers. Those properties are stored in a TileData object that can be accessed and modified using [method get_tile_data]. As TileData properties are stored directly in the TileSetAtlasSource resource, their properties might also be set using [code]TileSetAtlasSource.set("<coords_x>:<coords_y>/<alternative_id>/<tile_data_property>")[/code].
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) AsTileSetAtlasSource ¶
func (Instance) AsTileSetSource ¶
func (self Instance) AsTileSetSource() TileSetSource.Instance
func (Instance) ClearTilesOutsideTexture ¶
func (self Instance) ClearTilesOutsideTexture()
Removes all tiles that don't fit the available texture area. This method iterates over all the source's tiles, so it's advised to use [method has_tiles_outside_texture] beforehand.
func (Instance) CreateAlternativeTile ¶
Creates an alternative tile for the tile at coordinates [param atlas_coords]. If [param alternative_id_override] is -1, give it an automatically generated unique ID, or assigns it the given ID otherwise. Returns the new alternative identifier, or -1 if the alternative could not be created with a provided [param alternative_id_override].
func (Instance) CreateTile ¶
Creates a new tile at coordinates [param atlas_coords] with the given [param size].
func (Instance) GetAtlasGridSize ¶
Returns the atlas grid size, which depends on how many tiles can fit in the texture. It thus depends on the [member texture]'s size, the atlas [member margins], and the tiles' [member texture_region_size].
func (Instance) GetNextAlternativeTileId ¶
Returns the alternative ID a following call to [method create_alternative_tile] would return.
func (Instance) GetRuntimeTexture ¶
If [member use_texture_padding] is [code]false[/code], returns [member texture]. Otherwise, returns and internal [ImageTexture] created that includes the padding.
func (Instance) GetRuntimeTileTextureRegion ¶
func (self Instance) GetRuntimeTileTextureRegion(atlas_coords Vector2i.XY, frame_ int) Rect2i.PositionSize
Returns the region of the tile at coordinates [param atlas_coords] for the given [param frame] inside the texture returned by [method get_runtime_texture]. [b]Note:[/b] If [member use_texture_padding] is [code]false[/code], returns the same as [method get_tile_texture_region].
func (Instance) GetTileAnimationColumns ¶
Returns how many columns the tile at [param atlas_coords] has in its animation layout.
func (Instance) GetTileAnimationFrameDuration ¶
func (self Instance) GetTileAnimationFrameDuration(atlas_coords Vector2i.XY, frame_index int) Float.X
Returns the animation frame duration of frame [param frame_index] for the tile at coordinates [param atlas_coords].
func (Instance) GetTileAnimationFramesCount ¶
Returns how many animation frames has the tile at coordinates [param atlas_coords].
func (Instance) GetTileAnimationMode ¶
func (self Instance) GetTileAnimationMode(atlas_coords Vector2i.XY) TileAnimationMode
Returns the tile animation mode of the tile at [param atlas_coords]. See also [method set_tile_animation_mode].
func (Instance) GetTileAnimationSeparation ¶
Returns the separation (as in the atlas grid) between each frame of an animated tile at coordinates [param atlas_coords].
func (Instance) GetTileAnimationSpeed ¶
Returns the animation speed of the tile at coordinates [param atlas_coords].
func (Instance) GetTileAnimationTotalDuration ¶
Returns the sum of the sum of the frame durations of the tile at coordinates [param atlas_coords]. This value needs to be divided by the animation speed to get the actual animation loop duration.
func (Instance) GetTileAtCoords ¶
If there is a tile covering the [param atlas_coords] coordinates, returns the top-left coordinates of the tile (thus its coordinate ID). Returns [code]Vector2i(-1, -1)[/code] otherwise.
func (Instance) GetTileData ¶
Returns the [TileData] object for the given atlas coordinates and alternative ID.
func (Instance) GetTileSizeInAtlas ¶
Returns the size of the tile (in the grid coordinates system) at coordinates [param atlas_coords].
func (Instance) GetTileTextureRegion ¶
func (self Instance) GetTileTextureRegion(atlas_coords Vector2i.XY) Rect2i.PositionSize
Returns a tile's texture region in the atlas texture. For animated tiles, a [param frame] argument might be provided for the different frames of the animation.
func (Instance) GetTilesToBeRemovedOnChange ¶
func (self Instance) GetTilesToBeRemovedOnChange(texture Texture2D.Instance, margins Vector2i.XY, separation Vector2i.XY, texture_region_size Vector2i.XY) []Vector2.XY
Returns an array of tiles coordinates ID that will be automatically removed when modifying one or several of those properties: [param texture], [param margins], [param separation] or [param texture_region_size]. This can be used to undo changes that would have caused tiles data loss.
func (Instance) HasRoomForTile ¶
func (self Instance) HasRoomForTile(atlas_coords Vector2i.XY, size Vector2i.XY, animation_columns int, animation_separation Vector2i.XY, frames_count int) bool
Returns whether there is enough room in an atlas to create/modify a tile with the given properties. If [param ignored_tile] is provided, act as is the given tile was not present in the atlas. This may be used when you want to modify a tile's properties.
func (Instance) HasTilesOutsideTexture ¶
Checks if the source has any tiles that don't fit the texture area (either partially or completely).
func (Instance) MoveTileInAtlas ¶
Move the tile and its alternatives at the [param atlas_coords] coordinates to the [param new_atlas_coords] coordinates with the [param new_size] size. This functions will fail if a tile is already present in the given area. If [param new_atlas_coords] is [code]Vector2i(-1, -1)[/code], keeps the tile's coordinates. If [param new_size] is [code]Vector2i(-1, -1)[/code], keeps the tile's size. To avoid an error, first check if a move is possible using [method has_room_for_tile].
func (Instance) RemoveAlternativeTile ¶
Remove a tile's alternative with alternative ID [param alternative_tile]. Calling this function with [param alternative_tile] equals to 0 will fail, as the base tile alternative cannot be removed.
func (Instance) RemoveTile ¶
Remove a tile and its alternative at coordinates [param atlas_coords].
func (Instance) Separation ¶
func (Instance) SetAlternativeTileId ¶
func (self Instance) SetAlternativeTileId(atlas_coords Vector2i.XY, alternative_tile int, new_id int)
Change a tile's alternative ID from [param alternative_tile] to [param new_id]. Calling this function with [param new_id] of 0 will fail, as the base tile alternative cannot be moved.
func (Instance) SetMargins ¶
func (Instance) SetSeparation ¶
func (Instance) SetTexture ¶
func (Instance) SetTextureRegionSize ¶
func (Instance) SetTileAnimationColumns ¶
Sets the number of columns in the animation layout of the tile at coordinates [param atlas_coords]. If set to 0, then the different frames of the animation are laid out as a single horizontal line in the atlas.
func (Instance) SetTileAnimationFrameDuration ¶
func (self Instance) SetTileAnimationFrameDuration(atlas_coords Vector2i.XY, frame_index int, duration Float.X)
Sets the animation frame [param duration] of frame [param frame_index] for the tile at coordinates [param atlas_coords].
func (Instance) SetTileAnimationFramesCount ¶
Sets how many animation frames the tile at coordinates [param atlas_coords] has.
func (Instance) SetTileAnimationMode ¶
func (self Instance) SetTileAnimationMode(atlas_coords Vector2i.XY, mode TileAnimationMode)
Sets the tile animation mode of the tile at [param atlas_coords] to [param mode]. See also [method get_tile_animation_mode].
func (Instance) SetTileAnimationSeparation ¶
Sets the margin (in grid tiles) between each tile in the animation layout of the tile at coordinates [param atlas_coords] has.
func (Instance) SetTileAnimationSpeed ¶
Sets the animation speed of the tile at coordinates [param atlas_coords] has.
func (Instance) SetUseTexturePadding ¶
func (Instance) TextureRegionSize ¶
func (Instance) UseTexturePadding ¶
type TileAnimationMode ¶
type TileAnimationMode int //gd:TileSetAtlasSource.TileAnimationMode
const ( /*Tile animations start at same time, looking identical.*/ TileAnimationModeDefault TileAnimationMode = 0 /*Tile animations start at random times, looking varied.*/ TileAnimationModeRandomStartTimes TileAnimationMode = 1 /*Represents the size of the [enum TileAnimationMode] enum.*/ TileAnimationModeMax TileAnimationMode = 2 )