{"id":16186987,"url":"https://github.com/robloach/raylib-tmx","last_synced_at":"2026-03-06T14:02:36.205Z","repository":{"id":45077583,"uuid":"364202809","full_name":"RobLoach/raylib-tmx","owner":"RobLoach","description":"Load Tiled .tmx files for tile maps in raylib, using the TMX C Loader.","archived":false,"fork":false,"pushed_at":"2022-10-12T05:36:16.000Z","size":216,"stargazers_count":18,"open_issues_count":7,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-04-09T06:57:33.195Z","etag":null,"topics":["raylib","tiled","tiled-map-editor","tmx"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RobLoach.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-04T09:21:54.000Z","updated_at":"2023-03-13T16:17:00.000Z","dependencies_parsed_at":"2023-01-19T20:01:39.136Z","dependency_job_id":null,"html_url":"https://github.com/RobLoach/raylib-tmx","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobLoach%2Fraylib-tmx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobLoach%2Fraylib-tmx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobLoach%2Fraylib-tmx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobLoach%2Fraylib-tmx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobLoach","download_url":"https://codeload.github.com/RobLoach/raylib-tmx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243963585,"owners_count":20375644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["raylib","tiled","tiled-map-editor","tmx"],"created_at":"2024-10-10T07:19:58.972Z","updated_at":"2026-03-06T14:02:36.195Z","avatar_url":"https://github.com/RobLoach.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# raylib-tmx\n\nLoad [Tiled](https://www.mapeditor.org) `.tmx` files for tile maps in [raylib](https://www.raylib.com), with [TMX C Loader](https://github.com/baylej/tmx).\n\n![example/raylib-tmx-example.png](example/raylib-tmx-example.png)\n\n## Usage\n\nThis is a header-only library. To use it, define `RAYLIB_TMX_IMPLEMENTATION` in one *.c* source file before including *[raylib-tmx.h](include/raylib-tmx.h)*. You will also have to link its dependencies:\n\n- [raylib](https://www.raylib.com/)\n- [tmx](https://github.com/baylej/tmx)\n- [libxml2](http://xmlsoft.org)\n- [zlib](http://zlib.net/) (optional)\n\nIf you're using CMake, *libxml2* and *zlib* come packed in.\n\n### Example\n\nSee the [example directory](example) for a demonstration of how to use *raylib-tmx*.\n\n``` c\n#include \"raylib.h\"\n\n#define RAYLIB_TMX_IMPLEMENTATION\n#include \"raylib-tmx.h\"\n\nint main() {\n    InitWindow(800, 450, \"[raylib-tmx] example\");\n\n    tmx_map* map = LoadTMX(\"desert.tmx\");\n\n    while(!WindowShouldClose()) {\n\n        BeginDrawing();\n        {\n            ClearBackground(RAYWHITE);\n            DrawTMX(map, 0, 0, WHITE);\n        }\n        EndDrawing();\n    }\n\n    UnloadTMX(map);\n\n    CloseWindow();\n    return 0;\n}\n```\n\n### API\n\n``` c\ntmx_map* LoadTMX(const char* fileName);\nvoid UnloadTMX(tmx_map* map);\nColor ColorFromTMX(uint32_t color);\nvoid DrawTMX(tmx_map *map, int posX, int posY, Color tint);\nvoid DrawTMXLayer(tmx_map *map, tmx_layer *layers, int posX, int posY, Color tint);\nvoid DrawTMXTile(tmx_tile* tile, int posX, int posY, Color tint);\nvoid DrawTMXObjectTile(tmx_tile* tile, int baseGid, Rectangle destRect, float rotation, Color tint);\n\ntypedef struct {\n    enum {\n        COLLISION_RECT,\n        COLLISION_POINT,\n        COLLISION_POLYGON,\n        COLLISION_POLYLINE,\n        COLLISION_ELLIPSE\n    } type;\n    union {\n        Rectangle rect;\n        Vector2   point;\n        struct {\n            double** points;\n            int count;\n        } polygon;\n    };\n} RaylibTMXCollision;\n\ntypedef void (*tmx_collision_functor)(tmx_object *object, RaylibTMXCollision collision, void* userdata);\nvoid CollisionsTMXForeach(tmx_map *map, tmx_collision_functor callback, void* userdata);\nRaylibTMXCollision HandleTMXCollision(tmx_object* object);\n```\n\nRefer to the [libTMX documentation](http://libtmx.rtfd.io/) to see how to use the `tmx_map*` map object beyond rendering.\n\n## Development\n\nTo build the example locally, and run tests, use [cmake](https://cmake.org/).\n\n``` bash\ngit submodule update --init\nmkdir build\ncd build\ncmake ..\nmake\ncd examples\n./raylib-tmx-example\n```\n\n## Alternatives\n\nThis is not the only attempt to get Tiled working in raylib...\n\n- [raylib-tileson](https://github.com/robloach/raylib-tileson): Uses the [tileson C++ library](https://github.com/SSBMTonberry/tileson)\n- [raylib-tiled](https://github.com/RobLoach/raylib-tiled): Not working, but leverages the [cute_tiled.h library](https://github.com/RandyGaul/cute_headers/blob/master/cute_tiled.h) instead\n\n## Contributors\n\n- [Bayle Jonathan](https://github.com/baylej) for TMX C Loader, and the [tmx example](https://github.com/baylej/tmx/blob/master/examples/raylib/raylib.c) this was inspired from\n- [burakssen](https://github.com/burakssen)\n- [mattj1](https://github.com/mattj1)\n- [brccabral](https://github.com/brccabral)\n- [cortexmancer](https://github.com/cortexmancer)\n\n## License\n\n*raylib-tmx* is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobloach%2Fraylib-tmx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobloach%2Fraylib-tmx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobloach%2Fraylib-tmx/lists"}