diff options
author | kdx <kikoodx@paranoici.org> | 2024-01-23 10:05:41 +0100 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2024-01-23 10:07:17 +0100 |
commit | 5fc49efb18af15f0558bff946774799f11446c60 (patch) | |
tree | 73595bfd25dce1d341fc4bb83fcd75860601e77b | |
parent | 7aeb1b5c602b1fbe4b6f3eb3c4dc974b15af745a (diff) | |
download | tiled2c-5fc49efb18af15f0558bff946774799f11446c60.tar.gz |
tile objects
-rw-r--r-- | src/main.c | 14 | ||||
-rw-r--r-- | tiled2c.h | 1 |
2 files changed, 11 insertions, 4 deletions
@@ -111,16 +111,22 @@ process_object(cJSON *json) JSON_GET_STRING(json, name); JSON_GET_STRING(json, type); JSON_GET(json, id); + cJSON *const tile = cJSON_GetObjectItem(json, "gid"); JSON_GET(json, x); JSON_GET(json, y); JSON_GET(json, width); JSON_GET(json, height); JSON_GET(json, rotation); JSON_GET(json, visible); - printf("{\"%s\",\"%s\",%d,%d,%d,%d,%d,%f,%d,", - name->valuestring, type->valuestring, id->valueint, x->valueint, - y->valueint, width->valueint, height->valueint, - rotation->valuedouble, cJSON_IsTrue(visible)); + printf("{\"%s\",\"%s\",%d,%d,%d,%d,%d,%d,%f,%d,", + name->valuestring, + type->valuestring, + id->valueint, + tile ? tile->valueint : 0, + x->valueint, y->valueint, + width->valueint, height->valueint, + rotation->valuedouble, + cJSON_IsTrue(visible)); cJSON *properties = cJSON_GetObjectItem(json, "properties"); if (!cJSON_IsArray(properties)) @@ -67,6 +67,7 @@ typedef struct { const char *name; const char *type; unsigned int id; + unsigned int tile; double x; double y; double width; |