1 /** 2 Tile library for tilemaps. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.tileset; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.classdb; 24 import godot.resource; 25 import godot.reference; 26 import godot.occluderpolygon2d; 27 import godot.navigationpolygon; 28 import godot.shape2d; 29 import godot.shadermaterial; 30 import godot.texture; 31 /** 32 Tile library for tilemaps. 33 34 A TileSet is a library of tiles for a $(D TileMap). It contains a list of tiles, each consisting of a sprite and optional collision shapes. 35 Tiles are referenced by a unique integer ID. 36 */ 37 @GodotBaseClass struct TileSet 38 { 39 package(godot) enum string _GODOT_internal_name = "TileSet"; 40 public: 41 @nogc nothrow: 42 union { /** */ godot_object _godot_object; /** */ Resource _GODOT_base; } 43 alias _GODOT_base this; 44 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 45 package(godot) __gshared bool _classBindingInitialized = false; 46 package(godot) static struct GDNativeClassBinding 47 { 48 __gshared: 49 @GodotName("_forward_atlas_subtile_selection") GodotMethod!(Vector2, long, GodotObject, Vector2) _forwardAtlasSubtileSelection; 50 @GodotName("_forward_subtile_selection") GodotMethod!(Vector2, long, long, GodotObject, Vector2) _forwardSubtileSelection; 51 @GodotName("_is_tile_bound") GodotMethod!(bool, long, long) _isTileBound; 52 @GodotName("autotile_clear_bitmask_map") GodotMethod!(void, long) autotileClearBitmaskMap; 53 @GodotName("autotile_get_bitmask") GodotMethod!(long, long, Vector2) autotileGetBitmask; 54 @GodotName("autotile_get_bitmask_mode") GodotMethod!(TileSet.BitmaskMode, long) autotileGetBitmaskMode; 55 @GodotName("autotile_get_icon_coordinate") GodotMethod!(Vector2, long) autotileGetIconCoordinate; 56 @GodotName("autotile_get_light_occluder") GodotMethod!(OccluderPolygon2D, long, Vector2) autotileGetLightOccluder; 57 @GodotName("autotile_get_navigation_polygon") GodotMethod!(NavigationPolygon, long, Vector2) autotileGetNavigationPolygon; 58 @GodotName("autotile_get_size") GodotMethod!(Vector2, long) autotileGetSize; 59 @GodotName("autotile_get_spacing") GodotMethod!(long, long) autotileGetSpacing; 60 @GodotName("autotile_get_subtile_priority") GodotMethod!(long, long, Vector2) autotileGetSubtilePriority; 61 @GodotName("autotile_get_z_index") GodotMethod!(long, long, Vector2) autotileGetZIndex; 62 @GodotName("autotile_set_bitmask") GodotMethod!(void, long, Vector2, long) autotileSetBitmask; 63 @GodotName("autotile_set_bitmask_mode") GodotMethod!(void, long, long) autotileSetBitmaskMode; 64 @GodotName("autotile_set_icon_coordinate") GodotMethod!(void, long, Vector2) autotileSetIconCoordinate; 65 @GodotName("autotile_set_light_occluder") GodotMethod!(void, long, OccluderPolygon2D, Vector2) autotileSetLightOccluder; 66 @GodotName("autotile_set_navigation_polygon") GodotMethod!(void, long, NavigationPolygon, Vector2) autotileSetNavigationPolygon; 67 @GodotName("autotile_set_size") GodotMethod!(void, long, Vector2) autotileSetSize; 68 @GodotName("autotile_set_spacing") GodotMethod!(void, long, long) autotileSetSpacing; 69 @GodotName("autotile_set_subtile_priority") GodotMethod!(void, long, Vector2, long) autotileSetSubtilePriority; 70 @GodotName("autotile_set_z_index") GodotMethod!(void, long, Vector2, long) autotileSetZIndex; 71 @GodotName("clear") GodotMethod!(void) clear; 72 @GodotName("create_tile") GodotMethod!(void, long) createTile; 73 @GodotName("find_tile_by_name") GodotMethod!(long, String) findTileByName; 74 @GodotName("get_last_unused_tile_id") GodotMethod!(long) getLastUnusedTileId; 75 @GodotName("get_tiles_ids") GodotMethod!(Array) getTilesIds; 76 @GodotName("remove_tile") GodotMethod!(void, long) removeTile; 77 @GodotName("tile_add_shape") GodotMethod!(void, long, Shape2D, Transform2D, bool, Vector2) tileAddShape; 78 @GodotName("tile_get_light_occluder") GodotMethod!(OccluderPolygon2D, long) tileGetLightOccluder; 79 @GodotName("tile_get_material") GodotMethod!(ShaderMaterial, long) tileGetMaterial; 80 @GodotName("tile_get_modulate") GodotMethod!(Color, long) tileGetModulate; 81 @GodotName("tile_get_name") GodotMethod!(String, long) tileGetName; 82 @GodotName("tile_get_navigation_polygon") GodotMethod!(NavigationPolygon, long) tileGetNavigationPolygon; 83 @GodotName("tile_get_navigation_polygon_offset") GodotMethod!(Vector2, long) tileGetNavigationPolygonOffset; 84 @GodotName("tile_get_normal_map") GodotMethod!(Texture, long) tileGetNormalMap; 85 @GodotName("tile_get_occluder_offset") GodotMethod!(Vector2, long) tileGetOccluderOffset; 86 @GodotName("tile_get_region") GodotMethod!(Rect2, long) tileGetRegion; 87 @GodotName("tile_get_shape") GodotMethod!(Shape2D, long, long) tileGetShape; 88 @GodotName("tile_get_shape_count") GodotMethod!(long, long) tileGetShapeCount; 89 @GodotName("tile_get_shape_offset") GodotMethod!(Vector2, long, long) tileGetShapeOffset; 90 @GodotName("tile_get_shape_one_way") GodotMethod!(bool, long, long) tileGetShapeOneWay; 91 @GodotName("tile_get_shape_one_way_margin") GodotMethod!(double, long, long) tileGetShapeOneWayMargin; 92 @GodotName("tile_get_shape_transform") GodotMethod!(Transform2D, long, long) tileGetShapeTransform; 93 @GodotName("tile_get_shapes") GodotMethod!(Array, long) tileGetShapes; 94 @GodotName("tile_get_texture") GodotMethod!(Texture, long) tileGetTexture; 95 @GodotName("tile_get_texture_offset") GodotMethod!(Vector2, long) tileGetTextureOffset; 96 @GodotName("tile_get_tile_mode") GodotMethod!(TileSet.TileMode, long) tileGetTileMode; 97 @GodotName("tile_get_z_index") GodotMethod!(long, long) tileGetZIndex; 98 @GodotName("tile_set_light_occluder") GodotMethod!(void, long, OccluderPolygon2D) tileSetLightOccluder; 99 @GodotName("tile_set_material") GodotMethod!(void, long, ShaderMaterial) tileSetMaterial; 100 @GodotName("tile_set_modulate") GodotMethod!(void, long, Color) tileSetModulate; 101 @GodotName("tile_set_name") GodotMethod!(void, long, String) tileSetName; 102 @GodotName("tile_set_navigation_polygon") GodotMethod!(void, long, NavigationPolygon) tileSetNavigationPolygon; 103 @GodotName("tile_set_navigation_polygon_offset") GodotMethod!(void, long, Vector2) tileSetNavigationPolygonOffset; 104 @GodotName("tile_set_normal_map") GodotMethod!(void, long, Texture) tileSetNormalMap; 105 @GodotName("tile_set_occluder_offset") GodotMethod!(void, long, Vector2) tileSetOccluderOffset; 106 @GodotName("tile_set_region") GodotMethod!(void, long, Rect2) tileSetRegion; 107 @GodotName("tile_set_shape") GodotMethod!(void, long, long, Shape2D) tileSetShape; 108 @GodotName("tile_set_shape_offset") GodotMethod!(void, long, long, Vector2) tileSetShapeOffset; 109 @GodotName("tile_set_shape_one_way") GodotMethod!(void, long, long, bool) tileSetShapeOneWay; 110 @GodotName("tile_set_shape_one_way_margin") GodotMethod!(void, long, long, double) tileSetShapeOneWayMargin; 111 @GodotName("tile_set_shape_transform") GodotMethod!(void, long, long, Transform2D) tileSetShapeTransform; 112 @GodotName("tile_set_shapes") GodotMethod!(void, long, Array) tileSetShapes; 113 @GodotName("tile_set_texture") GodotMethod!(void, long, Texture) tileSetTexture; 114 @GodotName("tile_set_texture_offset") GodotMethod!(void, long, Vector2) tileSetTextureOffset; 115 @GodotName("tile_set_tile_mode") GodotMethod!(void, long, long) tileSetTileMode; 116 @GodotName("tile_set_z_index") GodotMethod!(void, long, long) tileSetZIndex; 117 } 118 /// 119 pragma(inline, true) bool opEquals(in TileSet other) const 120 { return _godot_object.ptr is other._godot_object.ptr; } 121 /// 122 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 123 { _godot_object.ptr = n; return null; } 124 /// 125 pragma(inline, true) bool opEquals(typeof(null) n) const 126 { return _godot_object.ptr is n; } 127 /// 128 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 129 mixin baseCasts; 130 /// Construct a new instance of TileSet. 131 /// Note: use `memnew!TileSet` instead. 132 static TileSet _new() 133 { 134 static godot_class_constructor constructor; 135 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("TileSet"); 136 if(constructor is null) return typeof(this).init; 137 return cast(TileSet)(constructor()); 138 } 139 @disable new(size_t s); 140 /// 141 enum TileMode : int 142 { 143 /** 144 145 */ 146 singleTile = 0, 147 /** 148 149 */ 150 autoTile = 1, 151 /** 152 153 */ 154 atlasTile = 2, 155 } 156 /// 157 enum AutotileBindings : int 158 { 159 /** 160 161 */ 162 bindTopleft = 1, 163 /** 164 165 */ 166 bindTop = 2, 167 /** 168 169 */ 170 bindTopright = 4, 171 /** 172 173 */ 174 bindLeft = 8, 175 /** 176 177 */ 178 bindCenter = 16, 179 /** 180 181 */ 182 bindRight = 32, 183 /** 184 185 */ 186 bindBottomleft = 64, 187 /** 188 189 */ 190 bindBottom = 128, 191 /** 192 193 */ 194 bindBottomright = 256, 195 } 196 /// 197 enum BitmaskMode : int 198 { 199 /** 200 201 */ 202 bitmask2x2 = 0, 203 /** 204 205 */ 206 bitmask3x3Minimal = 1, 207 /** 208 209 */ 210 bitmask3x3 = 2, 211 } 212 /// 213 enum Constants : int 214 { 215 singleTile = 0, 216 bitmask2x2 = 0, 217 autoTile = 1, 218 bitmask3x3Minimal = 1, 219 bindTopleft = 1, 220 bindTop = 2, 221 bitmask3x3 = 2, 222 atlasTile = 2, 223 bindTopright = 4, 224 bindLeft = 8, 225 bindCenter = 16, 226 bindRight = 32, 227 bindBottomleft = 64, 228 bindBottom = 128, 229 bindBottomright = 256, 230 } 231 /** 232 233 */ 234 Vector2 _forwardAtlasSubtileSelection(in long atlastile_id, GodotObject tilemap, in Vector2 tile_location) 235 { 236 Array _GODOT_args = Array.make(); 237 _GODOT_args.append(atlastile_id); 238 _GODOT_args.append(tilemap); 239 _GODOT_args.append(tile_location); 240 String _GODOT_method_name = String("_forward_atlas_subtile_selection"); 241 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!Vector2); 242 } 243 /** 244 245 */ 246 Vector2 _forwardSubtileSelection(in long autotile_id, in long bitmask, GodotObject tilemap, in Vector2 tile_location) 247 { 248 Array _GODOT_args = Array.make(); 249 _GODOT_args.append(autotile_id); 250 _GODOT_args.append(bitmask); 251 _GODOT_args.append(tilemap); 252 _GODOT_args.append(tile_location); 253 String _GODOT_method_name = String("_forward_subtile_selection"); 254 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!Vector2); 255 } 256 /** 257 Determines when the auto-tiler should consider two different auto-tile IDs to be bound together. 258 $(B Note:) `neighbor_id` will be `-1` ($(D constant TileMap.INVALID_CELL)) when checking a tile against an empty neighbor tile. 259 */ 260 bool _isTileBound(in long drawn_id, in long neighbor_id) 261 { 262 Array _GODOT_args = Array.make(); 263 _GODOT_args.append(drawn_id); 264 _GODOT_args.append(neighbor_id); 265 String _GODOT_method_name = String("_is_tile_bound"); 266 return this.callv(_GODOT_method_name, _GODOT_args).as!(RefOrT!bool); 267 } 268 /** 269 Clears all bitmask information of the autotile. 270 */ 271 void autotileClearBitmaskMap(in long id) 272 { 273 checkClassBinding!(typeof(this))(); 274 ptrcall!(void)(GDNativeClassBinding.autotileClearBitmaskMap, _godot_object, id); 275 } 276 /** 277 Returns the bitmask of the subtile from an autotile given its coordinates. 278 The value is the sum of the values in $(D autotilebindings) present in the subtile (e.g. a value of 5 means the bitmask has bindings in both the top left and top right). 279 */ 280 long autotileGetBitmask(in long id, in Vector2 coord) 281 { 282 checkClassBinding!(typeof(this))(); 283 return ptrcall!(long)(GDNativeClassBinding.autotileGetBitmask, _godot_object, id, coord); 284 } 285 /** 286 Returns the $(D bitmaskmode) of the autotile. 287 */ 288 TileSet.BitmaskMode autotileGetBitmaskMode(in long id) const 289 { 290 checkClassBinding!(typeof(this))(); 291 return ptrcall!(TileSet.BitmaskMode)(GDNativeClassBinding.autotileGetBitmaskMode, _godot_object, id); 292 } 293 /** 294 Returns the subtile that's being used as an icon in an atlas/autotile given its coordinates. 295 The subtile defined as the icon will be used as a fallback when the atlas/autotile's bitmask information is incomplete. It will also be used to represent it in the TileSet editor. 296 */ 297 Vector2 autotileGetIconCoordinate(in long id) const 298 { 299 checkClassBinding!(typeof(this))(); 300 return ptrcall!(Vector2)(GDNativeClassBinding.autotileGetIconCoordinate, _godot_object, id); 301 } 302 /** 303 Returns the light occluder of the subtile from an atlas/autotile given its coordinates. 304 */ 305 Ref!OccluderPolygon2D autotileGetLightOccluder(in long id, in Vector2 coord) const 306 { 307 checkClassBinding!(typeof(this))(); 308 return ptrcall!(OccluderPolygon2D)(GDNativeClassBinding.autotileGetLightOccluder, _godot_object, id, coord); 309 } 310 /** 311 Returns the navigation polygon of the subtile from an atlas/autotile given its coordinates. 312 */ 313 Ref!NavigationPolygon autotileGetNavigationPolygon(in long id, in Vector2 coord) const 314 { 315 checkClassBinding!(typeof(this))(); 316 return ptrcall!(NavigationPolygon)(GDNativeClassBinding.autotileGetNavigationPolygon, _godot_object, id, coord); 317 } 318 /** 319 Returns the size of the subtiles in an atlas/autotile. 320 */ 321 Vector2 autotileGetSize(in long id) const 322 { 323 checkClassBinding!(typeof(this))(); 324 return ptrcall!(Vector2)(GDNativeClassBinding.autotileGetSize, _godot_object, id); 325 } 326 /** 327 Returns the spacing between subtiles of the atlas/autotile. 328 */ 329 long autotileGetSpacing(in long id) const 330 { 331 checkClassBinding!(typeof(this))(); 332 return ptrcall!(long)(GDNativeClassBinding.autotileGetSpacing, _godot_object, id); 333 } 334 /** 335 Returns the priority of the subtile from an autotile given its coordinates. 336 When more than one subtile has the same bitmask value, one of them will be picked randomly for drawing. Its priority will define how often it will be picked. 337 */ 338 long autotileGetSubtilePriority(in long id, in Vector2 coord) 339 { 340 checkClassBinding!(typeof(this))(); 341 return ptrcall!(long)(GDNativeClassBinding.autotileGetSubtilePriority, _godot_object, id, coord); 342 } 343 /** 344 Returns the drawing index of the subtile from an atlas/autotile given its coordinates. 345 */ 346 long autotileGetZIndex(in long id, in Vector2 coord) 347 { 348 checkClassBinding!(typeof(this))(); 349 return ptrcall!(long)(GDNativeClassBinding.autotileGetZIndex, _godot_object, id, coord); 350 } 351 /** 352 Sets the bitmask of the subtile from an autotile given its coordinates. 353 The value is the sum of the values in $(D autotilebindings) present in the subtile (e.g. a value of 5 means the bitmask has bindings in both the top left and top right). 354 */ 355 void autotileSetBitmask(in long id, in Vector2 bitmask, in long flag) 356 { 357 checkClassBinding!(typeof(this))(); 358 ptrcall!(void)(GDNativeClassBinding.autotileSetBitmask, _godot_object, id, bitmask, flag); 359 } 360 /** 361 Sets the $(D bitmaskmode) of the autotile. 362 */ 363 void autotileSetBitmaskMode(in long id, in long mode) 364 { 365 checkClassBinding!(typeof(this))(); 366 ptrcall!(void)(GDNativeClassBinding.autotileSetBitmaskMode, _godot_object, id, mode); 367 } 368 /** 369 Sets the subtile that will be used as an icon in an atlas/autotile given its coordinates. 370 The subtile defined as the icon will be used as a fallback when the atlas/autotile's bitmask information is incomplete. It will also be used to represent it in the TileSet editor. 371 */ 372 void autotileSetIconCoordinate(in long id, in Vector2 coord) 373 { 374 checkClassBinding!(typeof(this))(); 375 ptrcall!(void)(GDNativeClassBinding.autotileSetIconCoordinate, _godot_object, id, coord); 376 } 377 /** 378 Sets the light occluder of the subtile from an atlas/autotile given its coordinates. 379 */ 380 void autotileSetLightOccluder(in long id, OccluderPolygon2D light_occluder, in Vector2 coord) 381 { 382 checkClassBinding!(typeof(this))(); 383 ptrcall!(void)(GDNativeClassBinding.autotileSetLightOccluder, _godot_object, id, light_occluder, coord); 384 } 385 /** 386 Sets the navigation polygon of the subtile from an atlas/autotile given its coordinates. 387 */ 388 void autotileSetNavigationPolygon(in long id, NavigationPolygon navigation_polygon, in Vector2 coord) 389 { 390 checkClassBinding!(typeof(this))(); 391 ptrcall!(void)(GDNativeClassBinding.autotileSetNavigationPolygon, _godot_object, id, navigation_polygon, coord); 392 } 393 /** 394 Sets the size of the subtiles in an atlas/autotile. 395 */ 396 void autotileSetSize(in long id, in Vector2 size) 397 { 398 checkClassBinding!(typeof(this))(); 399 ptrcall!(void)(GDNativeClassBinding.autotileSetSize, _godot_object, id, size); 400 } 401 /** 402 Sets the spacing between subtiles of the atlas/autotile. 403 */ 404 void autotileSetSpacing(in long id, in long spacing) 405 { 406 checkClassBinding!(typeof(this))(); 407 ptrcall!(void)(GDNativeClassBinding.autotileSetSpacing, _godot_object, id, spacing); 408 } 409 /** 410 Sets the priority of the subtile from an autotile given its coordinates. 411 When more than one subtile has the same bitmask value, one of them will be picked randomly for drawing. Its priority will define how often it will be picked. 412 */ 413 void autotileSetSubtilePriority(in long id, in Vector2 coord, in long priority) 414 { 415 checkClassBinding!(typeof(this))(); 416 ptrcall!(void)(GDNativeClassBinding.autotileSetSubtilePriority, _godot_object, id, coord, priority); 417 } 418 /** 419 Sets the drawing index of the subtile from an atlas/autotile given its coordinates. 420 */ 421 void autotileSetZIndex(in long id, in Vector2 coord, in long z_index) 422 { 423 checkClassBinding!(typeof(this))(); 424 ptrcall!(void)(GDNativeClassBinding.autotileSetZIndex, _godot_object, id, coord, z_index); 425 } 426 /** 427 Clears all tiles. 428 */ 429 void clear() 430 { 431 checkClassBinding!(typeof(this))(); 432 ptrcall!(void)(GDNativeClassBinding.clear, _godot_object); 433 } 434 /** 435 Creates a new tile with the given ID. 436 */ 437 void createTile(in long id) 438 { 439 checkClassBinding!(typeof(this))(); 440 ptrcall!(void)(GDNativeClassBinding.createTile, _godot_object, id); 441 } 442 /** 443 Returns the first tile matching the given name. 444 */ 445 long findTileByName(in String name) const 446 { 447 checkClassBinding!(typeof(this))(); 448 return ptrcall!(long)(GDNativeClassBinding.findTileByName, _godot_object, name); 449 } 450 /** 451 Returns the ID following the last currently used ID, useful when creating a new tile. 452 */ 453 long getLastUnusedTileId() const 454 { 455 checkClassBinding!(typeof(this))(); 456 return ptrcall!(long)(GDNativeClassBinding.getLastUnusedTileId, _godot_object); 457 } 458 /** 459 Returns an array of all currently used tile IDs. 460 */ 461 Array getTilesIds() const 462 { 463 checkClassBinding!(typeof(this))(); 464 return ptrcall!(Array)(GDNativeClassBinding.getTilesIds, _godot_object); 465 } 466 /** 467 Removes the given tile ID. 468 */ 469 void removeTile(in long id) 470 { 471 checkClassBinding!(typeof(this))(); 472 ptrcall!(void)(GDNativeClassBinding.removeTile, _godot_object, id); 473 } 474 /** 475 Adds a shape to the tile. 476 */ 477 void tileAddShape(in long id, Shape2D shape, in Transform2D shape_transform, in bool one_way = false, in Vector2 autotile_coord = Vector2(0, 0)) 478 { 479 checkClassBinding!(typeof(this))(); 480 ptrcall!(void)(GDNativeClassBinding.tileAddShape, _godot_object, id, shape, shape_transform, one_way, autotile_coord); 481 } 482 /** 483 Returns the tile's light occluder. 484 */ 485 Ref!OccluderPolygon2D tileGetLightOccluder(in long id) const 486 { 487 checkClassBinding!(typeof(this))(); 488 return ptrcall!(OccluderPolygon2D)(GDNativeClassBinding.tileGetLightOccluder, _godot_object, id); 489 } 490 /** 491 Returns the tile's material. 492 */ 493 Ref!ShaderMaterial tileGetMaterial(in long id) const 494 { 495 checkClassBinding!(typeof(this))(); 496 return ptrcall!(ShaderMaterial)(GDNativeClassBinding.tileGetMaterial, _godot_object, id); 497 } 498 /** 499 Returns the tile's modulation color. 500 */ 501 Color tileGetModulate(in long id) const 502 { 503 checkClassBinding!(typeof(this))(); 504 return ptrcall!(Color)(GDNativeClassBinding.tileGetModulate, _godot_object, id); 505 } 506 /** 507 Returns the tile's name. 508 */ 509 String tileGetName(in long id) const 510 { 511 checkClassBinding!(typeof(this))(); 512 return ptrcall!(String)(GDNativeClassBinding.tileGetName, _godot_object, id); 513 } 514 /** 515 Returns the navigation polygon of the tile. 516 */ 517 Ref!NavigationPolygon tileGetNavigationPolygon(in long id) const 518 { 519 checkClassBinding!(typeof(this))(); 520 return ptrcall!(NavigationPolygon)(GDNativeClassBinding.tileGetNavigationPolygon, _godot_object, id); 521 } 522 /** 523 Returns the offset of the tile's navigation polygon. 524 */ 525 Vector2 tileGetNavigationPolygonOffset(in long id) const 526 { 527 checkClassBinding!(typeof(this))(); 528 return ptrcall!(Vector2)(GDNativeClassBinding.tileGetNavigationPolygonOffset, _godot_object, id); 529 } 530 /** 531 Returns the tile's normal map texture. 532 */ 533 Ref!Texture tileGetNormalMap(in long id) const 534 { 535 checkClassBinding!(typeof(this))(); 536 return ptrcall!(Texture)(GDNativeClassBinding.tileGetNormalMap, _godot_object, id); 537 } 538 /** 539 Returns the offset of the tile's light occluder. 540 */ 541 Vector2 tileGetOccluderOffset(in long id) const 542 { 543 checkClassBinding!(typeof(this))(); 544 return ptrcall!(Vector2)(GDNativeClassBinding.tileGetOccluderOffset, _godot_object, id); 545 } 546 /** 547 Returns the tile sub-region in the texture. 548 */ 549 Rect2 tileGetRegion(in long id) const 550 { 551 checkClassBinding!(typeof(this))(); 552 return ptrcall!(Rect2)(GDNativeClassBinding.tileGetRegion, _godot_object, id); 553 } 554 /** 555 Returns a tile's given shape. 556 */ 557 Ref!Shape2D tileGetShape(in long id, in long shape_id) const 558 { 559 checkClassBinding!(typeof(this))(); 560 return ptrcall!(Shape2D)(GDNativeClassBinding.tileGetShape, _godot_object, id, shape_id); 561 } 562 /** 563 Returns the number of shapes assigned to a tile. 564 */ 565 long tileGetShapeCount(in long id) const 566 { 567 checkClassBinding!(typeof(this))(); 568 return ptrcall!(long)(GDNativeClassBinding.tileGetShapeCount, _godot_object, id); 569 } 570 /** 571 Returns the offset of a tile's shape. 572 */ 573 Vector2 tileGetShapeOffset(in long id, in long shape_id) const 574 { 575 checkClassBinding!(typeof(this))(); 576 return ptrcall!(Vector2)(GDNativeClassBinding.tileGetShapeOffset, _godot_object, id, shape_id); 577 } 578 /** 579 Returns the one-way collision value of a tile's shape. 580 */ 581 bool tileGetShapeOneWay(in long id, in long shape_id) const 582 { 583 checkClassBinding!(typeof(this))(); 584 return ptrcall!(bool)(GDNativeClassBinding.tileGetShapeOneWay, _godot_object, id, shape_id); 585 } 586 /** 587 588 */ 589 double tileGetShapeOneWayMargin(in long id, in long shape_id) const 590 { 591 checkClassBinding!(typeof(this))(); 592 return ptrcall!(double)(GDNativeClassBinding.tileGetShapeOneWayMargin, _godot_object, id, shape_id); 593 } 594 /** 595 Returns the $(D Transform2D) of a tile's shape. 596 */ 597 Transform2D tileGetShapeTransform(in long id, in long shape_id) const 598 { 599 checkClassBinding!(typeof(this))(); 600 return ptrcall!(Transform2D)(GDNativeClassBinding.tileGetShapeTransform, _godot_object, id, shape_id); 601 } 602 /** 603 Returns an array of dictionaries describing the tile's shapes. 604 $(B Dictionary structure in the array returned by this method:) 605 606 607 { 608 "autotile_coord": Vector2, 609 "one_way": bool, 610 "one_way_margin": int, 611 "shape": CollisionShape2D, 612 "shape_transform": Transform2D, 613 } 614 615 616 */ 617 Array tileGetShapes(in long id) const 618 { 619 checkClassBinding!(typeof(this))(); 620 return ptrcall!(Array)(GDNativeClassBinding.tileGetShapes, _godot_object, id); 621 } 622 /** 623 Returns the tile's texture. 624 */ 625 Ref!Texture tileGetTexture(in long id) const 626 { 627 checkClassBinding!(typeof(this))(); 628 return ptrcall!(Texture)(GDNativeClassBinding.tileGetTexture, _godot_object, id); 629 } 630 /** 631 Returns the texture offset of the tile. 632 */ 633 Vector2 tileGetTextureOffset(in long id) const 634 { 635 checkClassBinding!(typeof(this))(); 636 return ptrcall!(Vector2)(GDNativeClassBinding.tileGetTextureOffset, _godot_object, id); 637 } 638 /** 639 Returns the tile's $(D tilemode). 640 */ 641 TileSet.TileMode tileGetTileMode(in long id) const 642 { 643 checkClassBinding!(typeof(this))(); 644 return ptrcall!(TileSet.TileMode)(GDNativeClassBinding.tileGetTileMode, _godot_object, id); 645 } 646 /** 647 Returns the tile's Z index (drawing layer). 648 */ 649 long tileGetZIndex(in long id) const 650 { 651 checkClassBinding!(typeof(this))(); 652 return ptrcall!(long)(GDNativeClassBinding.tileGetZIndex, _godot_object, id); 653 } 654 /** 655 Sets a light occluder for the tile. 656 */ 657 void tileSetLightOccluder(in long id, OccluderPolygon2D light_occluder) 658 { 659 checkClassBinding!(typeof(this))(); 660 ptrcall!(void)(GDNativeClassBinding.tileSetLightOccluder, _godot_object, id, light_occluder); 661 } 662 /** 663 Sets the tile's material. 664 */ 665 void tileSetMaterial(in long id, ShaderMaterial material) 666 { 667 checkClassBinding!(typeof(this))(); 668 ptrcall!(void)(GDNativeClassBinding.tileSetMaterial, _godot_object, id, material); 669 } 670 /** 671 Sets the tile's modulation color. 672 */ 673 void tileSetModulate(in long id, in Color color) 674 { 675 checkClassBinding!(typeof(this))(); 676 ptrcall!(void)(GDNativeClassBinding.tileSetModulate, _godot_object, id, color); 677 } 678 /** 679 Sets the tile's name. 680 */ 681 void tileSetName(in long id, in String name) 682 { 683 checkClassBinding!(typeof(this))(); 684 ptrcall!(void)(GDNativeClassBinding.tileSetName, _godot_object, id, name); 685 } 686 /** 687 Sets the tile's navigation polygon. 688 */ 689 void tileSetNavigationPolygon(in long id, NavigationPolygon navigation_polygon) 690 { 691 checkClassBinding!(typeof(this))(); 692 ptrcall!(void)(GDNativeClassBinding.tileSetNavigationPolygon, _godot_object, id, navigation_polygon); 693 } 694 /** 695 Sets an offset for the tile's navigation polygon. 696 */ 697 void tileSetNavigationPolygonOffset(in long id, in Vector2 navigation_polygon_offset) 698 { 699 checkClassBinding!(typeof(this))(); 700 ptrcall!(void)(GDNativeClassBinding.tileSetNavigationPolygonOffset, _godot_object, id, navigation_polygon_offset); 701 } 702 /** 703 Sets the tile's normal map texture. 704 $(B Note:) Godot expects the normal map to use X+, Y-, and Z+ coordinates. See $(D url=http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates)this page$(D /url) for a comparison of normal map coordinates expected by popular engines. 705 */ 706 void tileSetNormalMap(in long id, Texture normal_map) 707 { 708 checkClassBinding!(typeof(this))(); 709 ptrcall!(void)(GDNativeClassBinding.tileSetNormalMap, _godot_object, id, normal_map); 710 } 711 /** 712 Sets an offset for the tile's light occluder. 713 */ 714 void tileSetOccluderOffset(in long id, in Vector2 occluder_offset) 715 { 716 checkClassBinding!(typeof(this))(); 717 ptrcall!(void)(GDNativeClassBinding.tileSetOccluderOffset, _godot_object, id, occluder_offset); 718 } 719 /** 720 Sets the tile's sub-region in the texture. This is common in texture atlases. 721 */ 722 void tileSetRegion(in long id, in Rect2 region) 723 { 724 checkClassBinding!(typeof(this))(); 725 ptrcall!(void)(GDNativeClassBinding.tileSetRegion, _godot_object, id, region); 726 } 727 /** 728 Sets a shape for the tile, enabling collision. 729 */ 730 void tileSetShape(in long id, in long shape_id, Shape2D shape) 731 { 732 checkClassBinding!(typeof(this))(); 733 ptrcall!(void)(GDNativeClassBinding.tileSetShape, _godot_object, id, shape_id, shape); 734 } 735 /** 736 Sets the offset of a tile's shape. 737 */ 738 void tileSetShapeOffset(in long id, in long shape_id, in Vector2 shape_offset) 739 { 740 checkClassBinding!(typeof(this))(); 741 ptrcall!(void)(GDNativeClassBinding.tileSetShapeOffset, _godot_object, id, shape_id, shape_offset); 742 } 743 /** 744 Enables one-way collision on a tile's shape. 745 */ 746 void tileSetShapeOneWay(in long id, in long shape_id, in bool one_way) 747 { 748 checkClassBinding!(typeof(this))(); 749 ptrcall!(void)(GDNativeClassBinding.tileSetShapeOneWay, _godot_object, id, shape_id, one_way); 750 } 751 /** 752 753 */ 754 void tileSetShapeOneWayMargin(in long id, in long shape_id, in double one_way) 755 { 756 checkClassBinding!(typeof(this))(); 757 ptrcall!(void)(GDNativeClassBinding.tileSetShapeOneWayMargin, _godot_object, id, shape_id, one_way); 758 } 759 /** 760 Sets a $(D Transform2D) on a tile's shape. 761 */ 762 void tileSetShapeTransform(in long id, in long shape_id, in Transform2D shape_transform) 763 { 764 checkClassBinding!(typeof(this))(); 765 ptrcall!(void)(GDNativeClassBinding.tileSetShapeTransform, _godot_object, id, shape_id, shape_transform); 766 } 767 /** 768 Sets an array of shapes for the tile, enabling collision. 769 */ 770 void tileSetShapes(in long id, in Array shapes) 771 { 772 checkClassBinding!(typeof(this))(); 773 ptrcall!(void)(GDNativeClassBinding.tileSetShapes, _godot_object, id, shapes); 774 } 775 /** 776 Sets the tile's texture. 777 */ 778 void tileSetTexture(in long id, Texture texture) 779 { 780 checkClassBinding!(typeof(this))(); 781 ptrcall!(void)(GDNativeClassBinding.tileSetTexture, _godot_object, id, texture); 782 } 783 /** 784 Sets the tile's texture offset. 785 */ 786 void tileSetTextureOffset(in long id, in Vector2 texture_offset) 787 { 788 checkClassBinding!(typeof(this))(); 789 ptrcall!(void)(GDNativeClassBinding.tileSetTextureOffset, _godot_object, id, texture_offset); 790 } 791 /** 792 Sets the tile's $(D tilemode). 793 */ 794 void tileSetTileMode(in long id, in long tilemode) 795 { 796 checkClassBinding!(typeof(this))(); 797 ptrcall!(void)(GDNativeClassBinding.tileSetTileMode, _godot_object, id, tilemode); 798 } 799 /** 800 Sets the tile's drawing index. 801 */ 802 void tileSetZIndex(in long id, in long z_index) 803 { 804 checkClassBinding!(typeof(this))(); 805 ptrcall!(void)(GDNativeClassBinding.tileSetZIndex, _godot_object, id, z_index); 806 } 807 }