I have used tilemaps .TMX files using cocos2d and objective c.

How are tilemaps used in C? Are there libraries available or where is a good place to start for using tilemaps in C?

I would like to create a tilemap using a tool. if this is supported by a library in C and then read each tiles layer.

How is this done in C?

  • \$\begingroup\$ It's done in C the same way it's done in any other language. If there isn't a good library you can write one yourself. The fundamentals are the same. \$\endgroup\$
    – Tetrad
    Mar 25, 2011 at 14:38

1 Answer 1


I've used "Tiled Map Editor" http://www.mapeditor.org/ for a iPhone game with good results. Our engine was made in house, but Tiled has his own format file that you can parse easily or you can append a custom format.

Tile supports layer, metaobjects to place the positions of objects in the game or anything else. It's multiplatform and free.

You provide an image with all tiles. Each tile is represented by a number. When you draw the map in the editor, the output is a matrix with the numbers that represents the tiles, with this identifiers you can put the tiles in your game in the correct order.

  • \$\begingroup\$ Are you describing how to use it for an iphone game(objective C)? I am asking about using C. \$\endgroup\$
    – some_id
    Mar 25, 2011 at 14:36
  • \$\begingroup\$ I'm describing the generic form. I used it with C++, but it is perfectly valid to C. You have to use the file read functions of C/C++ and parse the file that Tiled generates. For C: go4expert.com/forums/showthread.php?t=2977, for C++: cplusplus.com/doc/tutorial/files \$\endgroup\$
    – momboco
    Mar 25, 2011 at 14:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .