Skip to content
0.2.0-dev Download ZIP
62 lines ·3.1 KB Raw
1<?xml version="1.0" encoding="UTF-8" ?>
2<class name="TileSetSource" inherits="Resource" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
3 <brief_description>
4 Exposes a set of tiles for a [TileSet] resource.
5 </brief_description>
6 <description>
7 Exposes a set of tiles for a [TileSet] resource.
8 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.
9 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.
10 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].
11 [b]Warning:[/b] [TileSetSource] can only be added to one TileSet at the same time. Calling [method TileSet.add_source] on a second [TileSet] will remove the source from the first one.
12 </description>
13 <tutorials>
14 </tutorials>
15 <methods>
16 <method name="get_alternative_tile_id" qualifiers="const">
17 <return type="int" />
18 <param index="0" name="atlas_coords" type="Vector2i" />
19 <param index="1" name="index" type="int" />
20 <description>
21 Returns the alternative ID for the tile with coordinates ID [param atlas_coords] at index [param index].
22 </description>
23 </method>
24 <method name="get_alternative_tiles_count" qualifiers="const">
25 <return type="int" />
26 <param index="0" name="atlas_coords" type="Vector2i" />
27 <description>
28 Returns the number of alternatives tiles for the coordinates ID [param atlas_coords].
29 For [TileSetAtlasSource], this always return at least 1, as the base tile with ID 0 is always part of the alternatives list.
30 Returns -1 if there is not tile at the given coords.
31 </description>
32 </method>
33 <method name="get_tile_id" qualifiers="const">
34 <return type="Vector2i" />
35 <param index="0" name="index" type="int" />
36 <description>
37 Returns the tile coordinates ID of the tile with index [param index].
38 </description>
39 </method>
40 <method name="get_tiles_count" qualifiers="const">
41 <return type="int" />
42 <description>
43 Returns how many tiles this atlas source defines (not including alternative tiles).
44 </description>
45 </method>
46 <method name="has_alternative_tile" qualifiers="const">
47 <return type="bool" />
48 <param index="0" name="atlas_coords" type="Vector2i" />
49 <param index="1" name="alternative_tile" type="int" />
50 <description>
51 Returns if the base tile at coordinates [param atlas_coords] has an alternative with ID [param alternative_tile].
52 </description>
53 </method>
54 <method name="has_tile" qualifiers="const">
55 <return type="bool" />
56 <param index="0" name="atlas_coords" type="Vector2i" />
57 <description>
58 Returns if this atlas has a tile with coordinates ID [param atlas_coords].
59 </description>
60 </method>
61 </methods>
62</class>