- [FIX] Si hi havia linea en blanc al afegir un comentari, ficava una linea en blanc de més
- [FIX] Netejaeta abans de releasar a gitea
This commit is contained in:
33
main.cpp
33
main.cpp
@@ -12,10 +12,19 @@ std::string readFileToString(const std::string& filename) {
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
yamal root; // = yamal_parser::parse(readFileToString("test.yaml"));
|
||||
root.deserialize(readFileToString("data/room/02.yaml"));
|
||||
if (argc<2) { printf("ERROR: Falta un arxiu YAML com a paràmetre, meló.\n"); exit(-1); }
|
||||
|
||||
/*root["room"]["name"] = "THE JAIL";
|
||||
// Amb aquest codi es llig un YAML desde arxiu
|
||||
// ===========================================
|
||||
yamal root;
|
||||
root.deserialize(readFileToString(argv[1]));
|
||||
|
||||
// Amb aquest codi es crearia desde cero un YAML com el de test.yaml
|
||||
// =================================================================
|
||||
/*
|
||||
yamal root;
|
||||
root["room"].setComment("THE JAIL");
|
||||
root["room"]["name"] = "THE JAIL";
|
||||
root["room"]["name"].setQuoted(true);
|
||||
root["room"]["bgColor"] = "bright_blue";
|
||||
root["room"]["connections"]["up"] = "null";
|
||||
@@ -23,8 +32,11 @@ int main(int argc, char* argv[]) {
|
||||
root["room"]["connections"]["left"] = "null";
|
||||
root["room"]["connections"]["right"] = "02.yaml";
|
||||
root["room"]["itemColor1"] = "yellow";
|
||||
root["tilemap"][0][0] = 00;
|
||||
root["tilemap"][0][1] = 01;
|
||||
root["tilemap"].appendComment(""); // Linia en blanc
|
||||
root["tilemap"].appendComment("Tilemap: 16 filas x 32 columnas (256x192 píxeles @ 8px/tile)");
|
||||
root["tilemap"].appendComment("Índices de tiles (-1 = vacío)");
|
||||
root["tilemap"][0][0] = 0;
|
||||
root["tilemap"][0][1] = 1;
|
||||
root["tilemap"][1][0] = 10;
|
||||
root["tilemap"][1][1] = 11;
|
||||
root["tilemap"][0].setInline(true);
|
||||
@@ -37,6 +49,7 @@ int main(int argc, char* argv[]) {
|
||||
root["enemies"][0]["boundaries"]["position1"]["y"] = 1;
|
||||
root["enemies"][0]["boundaries"]["position1"].setInline(true);
|
||||
root["enemies"][0]["color"]= "white";
|
||||
root["enemies"][1].appendComment(""); // Linia en blanc
|
||||
root["enemies"][1]["animation"] = "jailer_2.yaml";
|
||||
root["enemies"][1]["position"]["x"] = 2;
|
||||
root["enemies"][1]["position"]["y"] = 23;
|
||||
@@ -47,12 +60,12 @@ int main(int argc, char* argv[]) {
|
||||
root["enemies"][1]["color"]= "black";
|
||||
root["items"].clearToVector();
|
||||
root["items"].setInline(true);
|
||||
root["items"].appendComment(""); // Linia en blanc
|
||||
*/
|
||||
|
||||
root["room"].setComment("THE JAIL");
|
||||
root["room"].setBlankLine(false);
|
||||
root["tilemap"].setComment("Tilemap: 16 filas x 32 columnas (256x192 píxeles @ 8px/tile)");
|
||||
root["tilemap"].appendComment("Índices de tiles (-1 = vacío)");
|
||||
root["room"]["bgColor"].setInlineComment("Azul oscuro");*/
|
||||
// Amb aquest codi es guarda a un std::string el YAML que hi ha en 'root'
|
||||
// (i, en aquest cas, el tire a la consola)
|
||||
// ======================================================================
|
||||
std::cout << root.serialize() << std::endl;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user