diff --git a/Levels/ObjectSetups/BackupLevel0.png b/Levels/ObjectSetups/BackupLevel0.png new file mode 100644 index 0000000..aa341c0 Binary files /dev/null and b/Levels/ObjectSetups/BackupLevel0.png differ diff --git a/Levels/ObjectSetups/Level0.xml b/Levels/ObjectSetups/Level0.xml new file mode 100644 index 0000000..6fcee82 --- /dev/null +++ b/Levels/ObjectSetups/Level0.xml @@ -0,0 +1,116 @@ + + 1.0 + 0.0 + 0.0 + 0.0 + 3.500000 + 0.0 + 3.500000 + 1 + 9 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + 3.500000 + 0.0 + -0.500000 + 1 + 8 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + 2.500000 + 0.0 + -2.500000 + 1 + 7 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + 1.500000 + 0.0 + 0.500000 + 1 + 6 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + -0.500000 + 0.0 + 1.500000 + 1 + 5 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + -0.500000 + 0.0 + -1.500000 + 1 + 4 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + -2.500000 + 0.0 + -1.500000 + 1 + 3 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + -3.500000 + 0.0 + -3.500000 + 1 + 2 + 99 + + + + 1.0 + 0.0 + 0.0 + 0.0 + -4.500000 + 0.0 + -4.500000 + 1 + 1 + 99 + diff --git a/Levels/Textures/ColumnTexture2.png b/Levels/Textures/columnTexture2.png similarity index 100% rename from Levels/Textures/ColumnTexture2.png rename to Levels/Textures/columnTexture2.png diff --git a/converter/converter.cc b/converter/converter.cc index 0dec1dc..8a62dd2 100644 --- a/converter/converter.cc +++ b/converter/converter.cc @@ -1,6 +1,7 @@ #include "converter.hh" #include #include +#include using namespace tinyxml2; @@ -14,10 +15,20 @@ Converter::Converter(std::string level){ printf("Could not open Compositions!!!\n"); } + //Create a backup of the current Level png file, if no backup exists + std::string pngFile = "../Levels/ObjectSetups/Level" + level + ".png"; + std::string backupPNG = "../Levels/ObjectSetups/BackupLevel" + level + ".png"; + struct stat buf; + if(stat(backupPNG.c_str(), &buf) != 0){ + std::ifstream src(pngFile, std::ios::binary); + std::ofstream dst(backupPNG, std::ios::binary); + dst << src.rdbuf(); + } + //Create a backup of the current Level xml file - std::string backup = "../Levels/ObjectSetups/BackupLevel" + level + ".xml"; + std::string backupXML = "../Levels/ObjectSetups/BackupLevel" + level + ".xml"; std::ifstream src(xmlFile, std::ios::binary); - std::ofstream dst(backup, std::ios::binary); + std::ofstream dst(backupXML, std::ios::binary); dst << src.rdbuf(); //Load the Level xml file