libtmx
0.4.0
an C++11 library for reading TMX files
|
An image object is an image that is part of an object layer in Tiled. This image is associated with a tile in a tileset. It is represented by a tmx::TileObject
in the library. This tutorial provides some hints on how to render this type of object in a neutral way, You should read How to render tiles with libtmx? before reading this tutorial as the first step is the same.
We visit the object layer.
First, it's not necessary to render the layer if it's not visible. This visibility property can be set in Tiled. Then if we find an image object in the objects of this layer, then we get its position and its gid and draw it.
The procedure for drawing the image is quite the same as the one in How to render tiles with libtmx?, except the call to drawImage
. Indeed, the origin of the image object is not at the top left of the image but at the bottom left. So the call to drawImage
is something like: