summaryrefslogtreecommitdiff
path: root/doc/classes/TileSetSource.xml
blob: 3d23975e37a786fb49ee53a274beed7f3d6a5b77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?xml version="1.0" encoding="UTF-8" ?>
<class name="TileSetSource" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
	<brief_description>
		Exposes a set of tiles for a [TileSet] resource.
	</brief_description>
	<description>
		Exposes a set of tiles for a [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 [TileSetAtlasSource] class.
		Depending on the TileSet source type, those IDs might have restrictions on their values, this is why the base [TileSetSource] class only exposes getters for them.

		You can iterate over all tiles exposed by a TileSetSource by first iterating over coordinates IDs using [method get_tiles_count] and [method get_tile_id], then over alternative IDs using [method get_alternative_tiles_count] and [method get_alternative_tile_id].
	</description>
	<tutorials>
	</tutorials>
	<methods>
		<method name="get_alternative_tile_id" qualifiers="const">
			<return type="int" />
			<argument index="0" name="atlas_coords" type="Vector2i" />
			<argument index="1" name="index" type="int" />
			<description>
				Returns the alternative ID for the tile with coordinates ID [code]atlas_coords[/code] at index [code]index[/code].
			</description>
		</method>
		<method name="get_alternative_tiles_count" qualifiers="const">
			<return type="int" />
			<argument index="0" name="atlas_coords" type="Vector2i" />
			<description>
				Returns the number of alternatives tiles for the coordinates ID [code]atlas_coords[/code].
				For [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.
			</description>
		</method>
		<method name="get_tile_id" qualifiers="const">
			<return type="Vector2i" />
			<argument index="0" name="index" type="int" />
			<description>
				Returns the tile coordinates ID of the tile with index [code]index[/code].
			</description>
		</method>
		<method name="get_tiles_count" qualifiers="const">
			<return type="int" />
			<description>
				Returns how many tiles this atlas source defines (not including alternative tiles).
			</description>
		</method>
		<method name="has_alternative_tile" qualifiers="const">
			<return type="bool" />
			<argument index="0" name="atlas_coords" type="Vector2i" />
			<argument index="1" name="alternative_tile" type="int" />
			<description>
				Returns if the base tile at coordinates [code]atlas_coords[/code] has an alternative with ID [code]alternative_tile[/code].
			</description>
		</method>
		<method name="has_tile" qualifiers="const">
			<return type="bool" />
			<argument index="0" name="atlas_coords" type="Vector2i" />
			<description>
				Returns if this atlas has a tile with coordinates ID [code]atlas_coordinates[/code].
			</description>
		</method>
	</methods>
</class>