TileSetSource

package
v0.0.0-...-c858641 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Exposes a set of tiles for a graphics.gd/classdb/TileSet resource.

Tiles in a source are indexed with two IDs, coordinates ID (of type Vector2i) and an alternative ID (of type int), named according to their use in the graphics.gd/classdb/TileSetAtlasSource class.

Depending on the TileSet source type, those IDs might have restrictions on their values, this is why the base graphics.gd/classdb/TileSetSource class only exposes getters for them.

You can iterate over all tiles exposed by a TileSetSource by first iterating over coordinates IDs using Instance.GetTilesCount and Instance.GetTileId, then over alternative IDs using Instance.GetAlternativeTilesCount and Instance.GetAlternativeTileId.

Warning: graphics.gd/classdb/TileSetSource can only be added to one TileSet at the same time. Calling graphics.gd/classdb/TileSet.Instance.AddSource on a second graphics.gd/classdb/TileSet will remove the source from the first one.

Index

Constants

This section is empty.

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 Any

type Any interface {
	gd.IsClass
	AsTileSetSource() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

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]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

func (*Extension[T]) AsTileSetSource

func (self *Extension[T]) AsTileSetSource() Instance

type ID

type ID Object.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.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.TileSetSource

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) AsTileSetSource

func (self Instance) AsTileSetSource() Instance

func (Instance) GetAlternativeTileId

func (self Instance) GetAlternativeTileId(atlas_coords Vector2i.XY, index int) int

Returns the alternative ID for the tile with coordinates ID 'atlas_coords' at index 'index'.

func (Instance) GetAlternativeTilesCount

func (self Instance) GetAlternativeTilesCount(atlas_coords Vector2i.XY) int

Returns the number of alternatives tiles for the coordinates ID 'atlas_coords'.

For graphics.gd/classdb/TileSetAtlasSource, this always return at least 1, as the base tile with ID 0 is always part of the alternatives list.

Returns -1 if there is not tile at the given coords.

func (Instance) GetTileId

func (self Instance) GetTileId(index int) Vector2i.XY

Returns the tile coordinates ID of the tile with index 'index'.

func (Instance) GetTilesCount

func (self Instance) GetTilesCount() int

Returns how many tiles this atlas source defines (not including alternative tiles).

func (Instance) HasAlternativeTile

func (self Instance) HasAlternativeTile(atlas_coords Vector2i.XY, alternative_tile int) bool

Returns if the base tile at coordinates 'atlas_coords' has an alternative with ID 'alternative_tile'.

func (Instance) HasTile

func (self Instance) HasTile(atlas_coords Vector2i.XY) bool

Returns if this atlas has a tile with coordinates ID 'atlas_coords'.

func (Instance) ID

func (self Instance) ID() ID

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL