1 module PixelPerfectEngine.map.mapdata; 2 /* 3 * Copyright (C) 2015-2017, by Laszlo Szeremi under the Boost license. 4 * 5 * Pixel Perfect Engine, map module 6 */ 7 import std.stdio; 8 import std.file; 9 import std.conv; 10 /* 11 public struct TileLayerData{ 12 public string source, name; 13 public wchar[] data; 14 public int mx, my, tileX, tileY, priority; 15 public double scrollRatioX, scrollRatioY; 16 public FileCollector[] fcList; 17 18 public this(int x, int y, wchar[] d){ 19 data = d; 20 mx = x; 21 my = y; 22 } 23 24 public this(int x, int y){ 25 mx = x; 26 my = y; 27 data.length = mx * my; 28 } 29 30 public this(string filename){ 31 wchar[] d = cast(wchar[])std.file.read(filename); 32 mx = d[0]; 33 my = d[1]; 34 data = d[2..(d.length-1)]; 35 } 36 37 public void store(string filename){ 38 wchar[] d; 39 d ~= to!wchar(mx); 40 d ~= to!wchar(my); 41 d ~= data; 42 std.file.write(filename, d); 43 } 44 } 45 46 public struct ObjectData{ 47 public int posX, posY; 48 public string type, aux; 49 50 public this(string t, int x, int y, string a = null){ 51 type = t; 52 posX = x; 53 posY = y; 54 aux = a; 55 } 56 } 57 58 public struct FileCollector{ 59 public string source; /// Name of the XMP file 60 public string[wchar] IDcollection; /// ID of bitmap in the XMP 61 public string[ushort] names; /// Used for editors 62 63 /*public this(){ 64 65 } 66 67 public void add(wchar ID, ushort num, string name =""){ 68 numcollection ~= num; 69 IDcollection[num] = ID; 70 names[num] = name; 71 } 72 }*/