Skip to content

pkeir/raylib-tileson

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

raylib-tileson

Use Tiled maps in raylib, through Tileson.

raylib-tileson Example Screenshot

Example

#include "raylib.h"

#define RAYLIB_TILESON_IMPLEMENTATION
#include "raylib-tileson.h"

int main(int argc, char* argv[]) {
    InitWindow(800, 450, "[raylib-tileson] example");
    SetTargetFPS(60);

    // Load the map
    Map map = LoadTiled("resources/desert.json");

    while (!WindowShouldClose()) {
        BeginDrawing();
        {
            ClearBackground(RAYWHITE);

            // Draw the map
            DrawTiled(map, 0, 0, WHITE);
        }
        EndDrawing();
    }

    // De-Initialization
    UnloadMap(map);

    CloseWindow();
    return 0;
}

Dependencies

API

Map LoadTiled(const char* fileName);
Map LoadTiledFromMemory(const unsigned char *fileData, int dataSize, const char* baseDir);
bool IsTiledReady(Map map);
void DrawTiled(Map map, int posX, int posY, Color tint);
void UnloadMap(Map map);

Alternatives

While raylib-tileson does compile and run from C, it requires compilation with C++17. Mixing C and C++ may not be preferable by all, so there could be a desire to use an alternative...

Development

mkdir build
cd build
cmake ..
make
./example/raylib-tileson-example

License

raylib-tileson is licensed under the BSD 2-Clause License, see LICENSE for more information.

About

Use Tiled maps in raylib, through Tileson.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 91.2%
  • C 7.4%
  • CMake 1.4%