30 lines
840 B
C
30 lines
840 B
C
#include "kubo_file.h"
|
|
|
|
void kubo_file_parse(char *file_name) {
|
|
static const cyaml_config_t config = {
|
|
.log_fn = cyaml_log,
|
|
.mem_fn = cyaml_mem,
|
|
.log_level = CYAML_LOG_WARNING,
|
|
};
|
|
|
|
struct kubo_file_scene *n;
|
|
|
|
cyaml_err_t err = cyaml_load_file(file_name, &config, &top_schema,
|
|
(cyaml_data_t **)&n, NULL);
|
|
if (err != CYAML_OK) {
|
|
printf("cyaml err\n");
|
|
}
|
|
|
|
for (unsigned i = 0; i < n->walls_count; i++) {
|
|
printf("wall:\n");
|
|
for (unsigned j = 0; j < n->walls[i].vertices_count; j++) {
|
|
printf("\t%f:%f\n", n->walls[i].vertices[j][0],
|
|
n->walls[i].vertices[j][1]);
|
|
}
|
|
}
|
|
|
|
err = cyaml_free(&config, &top_schema, n, 0);
|
|
if (err != CYAML_OK) {
|
|
printf("cyaml free err\n");
|
|
}
|
|
}
|