1 module wsf.spec.tileset; 2 import wsf.serialization; 3 4 /** 5 A region corrsponding to a file in the tileset 6 */ 7 struct TileRegion { 8 /** 9 The origin file 10 */ 11 string file; 12 13 /** 14 Where the tile region starts 15 */ 16 int x; 17 18 /** 19 Where the tile region starts 20 */ 21 int y; 22 23 /** 24 Width of tile region 25 */ 26 int width; 27 28 /** 29 Height of tile region 30 */ 31 int height; 32 } 33 34 /** 35 A tileset 36 */ 37 struct Tileset { 38 /** 39 Width of tileset texture 40 */ 41 uint width; 42 43 /** 44 Height of tileset texture 45 */ 46 uint height; 47 48 /** 49 8-bit RGBA color data 50 */ 51 ubyte[] data; 52 53 /** 54 Tile information 55 */ 56 TileInfo[] info; 57 58 /** 59 Loaded tile regions 60 */ 61 @optional 62 TileRegion[] regions; 63 64 /** 65 Scrub the region of contents 66 */ 67 void scrubRegions() { 68 regions = []; 69 } 70 } 71 72 /** 73 Information about a tile 74 */ 75 struct TileInfo { 76 /** 77 Numeric id of tile 78 */ 79 uint id; 80 81 /** 82 Human readable name 83 */ 84 @optional 85 string name = "%d"; 86 87 /** 88 Collission data for tile 89 */ 90 ubyte[][] collissionData; 91 92 }