C++ Game Dev Code
  • Code
    • C++ Tiled Map Loader
    • tolua++ Example

C++ Tiled Loader

Last Updated: 10 August, 2010

This example shows you how to load and display a tmx map made using Tiled. Tiled is an open source, cross-platform map editor. You can read more and download Tiled at www.mapeditor.org

This example uses the following libraries:
  • SDL (http://www.libsdl.org)
  • SDL_Image (http://www.libsdl.org/projects/SDL_image/)
  • TinyXML (http://www.grinninglizard.com/tinyxml/)
You can download the source code here (Only opens uncompressed base64 tmx files)
mapviewer.zip
File Size: 1466 kb
File Type: zip
Download File

UPDATE 10 Feb 2011
Big thanks to Cpasjuste (David Carré) for writing a gzip/zlib support patch:

TMXLoader.cpp : http://pastebin.com/ec1AMZDm
Decompress.cpp : http://pastebin.com/g85u14Jq
Base64.cpp : http://pastebin.com/wmyYncx5

Also, I'm currently rewriting the whole tmx loader from scratch and plan to upload the new version in June 2011.

Picture
Editing the map using Tiled.
Picture
Loading and displaying the map.
Powered by Create your own unique website with customizable templates.