Skip to content

Use Tiled maps in pntr, with cute_tiled.

License

Notifications You must be signed in to change notification settings

RobLoach/pntr_tiled

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pntr_tiled

Use Tiled maps in pntr, with cute_tiled.

Screenshot of pntr_tiled_example

Usage

#define PNTR_TILED_IMPLEMENTATION
#include "pntr_tiled.h"

int main() {
    // Load the Tiled JSON file
    cute_tiled_map_t* map = pntr_load_tiled("mymap.json");

    // Generate an image of the Tiled map
    pntr_image* image = pntr_gen_image_tiled(map, PNTR_WHITE);

    // Save the image as a PNG
    pntr_save_image(image, "world.png");

    return 0;
}

Features

  • Tile Layers
  • Image Layers
  • Group Layers
  • Object Layers
  • Animated Tiles
  • Flipped/Rotated Tiles

API

cute_tiled_map_t* pntr_load_tiled(const char* fileName);
cute_tiled_map_t* pntr_load_tiled_from_memory(const unsigned char *fileData, unsigned int dataSize, const char* baseDir);
void pntr_unload_tiled(cute_tiled_map_t* map);
void pntr_draw_tiled(pntr_image* dst, cute_tiled_map_t* map, int posX, int posY, pntr_color tint);
void pntr_draw_tiled_tile(pntr_image* dst, cute_tiled_map_t* map, int gid, int posX, int posY, pntr_color tint);
void pntr_draw_tiled_layer_imagelayer(pntr_image* dst, cute_tiled_map_t* map, cute_tiled_layer_t* layer, int posX, int posY, pntr_color tint);
void pntr_draw_tiled_layer_tilelayer(pntr_image* dst, cute_tiled_map_t* map, cute_tiled_layer_t* layer, int posX, int posY, pntr_color tint);
pntr_image* pntr_tiled_tile_image(cute_tiled_map_t* map, int gid);
pntr_image* pntr_gen_image_tiled(cute_tiled_map_t* map, pntr_color tint);
void pntr_update_tiled(cute_tiled_map_t* map, float deltaTime);
cute_tiled_layer_t* pntr_tiled_layer(cute_tiled_map_t* map, const char* name);
int pntr_layer_tile(cute_tiled_layer_t* layer, int column, int row);
void pntr_set_layer_tile(cute_tiled_layer_t* layer, int column, int row, int gid);
pntr_vector pntr_layer_tile_from_position(cute_tiled_map_t* map, cute_tiled_layer_t* layer, int posX, int posY);
cute_tiled_map_t* pntr_load_tiled_from_assetsys(assetsys_t* sys, const char* fileName);

License

Unless stated otherwise, all works are:

... and licensed under:

About

Use Tiled maps in pntr, with cute_tiled.

Topics

Resources

License

Stars

Watchers

Forks