Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
baylej committed Apr 7, 2024
1 parent a76778b commit 3d16ceb
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 2 deletions.
98 changes: 96 additions & 2 deletions doc/src/datastructure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ Enumerations
+---------------+--------------------------------------------------------+
| PT_FILE | Path to a file, use `value.file`. |
+---------------+--------------------------------------------------------+
| PT_OBJECT | An object, use `value.object_id`. |
+---------------+--------------------------------------------------------+
| PT_CUSTOM | Custom type, use `value.properties`. |
+---------------+--------------------------------------------------------+

.. c:type:: enum tmx_horizontal_align
Expand All @@ -239,6 +243,8 @@ Enumerations
+------------+------------------------------------------+
| HA_RIGHT | Right. |
+------------+------------------------------------------+
| HA_JUSTIFY | Justify. |
+------------+------------------------------------------+

.. c:type:: enum tmx_vertical_align
Expand All @@ -256,6 +262,34 @@ Enumerations
| VA_BOTTOM | Bottom. |
+------------+------------------------------------------+

.. c:type:: enum tmx_tile_render_size
The size to use when rendering tiles.

+-------------+-------------------------------------------+
| Render size | Description |
+=============+===========================================+
| TRS_NONE | In case of error, or unknown render size. |
+-------------+-------------------------------------------+
| TRS_TILE | Tile size in its tileset |
+-------------+-------------------------------------------+
| TRS_GRID | Tile grid size of the map |
+-------------+-------------------------------------------+

.. c:type:: enum tmx_fill_mode
The fill mode to use when rendering tiles scaled.

+------------------------+-----------------------------------------+
| Fill mode | Description |
+========================+=========================================+
| FM_NONE | In case of error, or unknown fill mode. |
+------------------------+-----------------------------------------+
| FM_STRETCH | Stretch to fit. |
+------------------------+-----------------------------------------+
| FM_PRESERVE_ASPECT_FIT | Preserve aspect ratio. |
+------------------------+-----------------------------------------+


Data Structures
---------------
Expand All @@ -267,6 +301,14 @@ you can access everything.
The :term:`root <Tree>` of the datastructure.

.. c:member:: char *format_version
The TMX format version, eg: "1.0".

.. c:member:: char *class_type
Class of the map (user defined).

.. c:member:: enum tmx_map_orient orient
Map orientation, see :c:type:`tmx_map_orient`.
Expand Down Expand Up @@ -300,6 +342,14 @@ you can access everything.
Only for hexagonal maps. Determines the width or height (depending on the staggered axis) of the tile’s edge,
in pixels.

.. c:member:: int parallaxoriginx
X coordinate of the parallax origin in pixels.

.. c:member:: int parallaxoriginy
Y coordinate of the parallax origin in pixels.

.. c:member:: unsigned int backgroundcolor
Global background colour, encoded in an integer, 4 bytes: ARGB.
Expand Down Expand Up @@ -344,6 +394,10 @@ you can access everything.
Name of the :term:`layer` (user defined).

.. c:member:: char *class_type
Class of the :term:`layer` (user defined).

.. c:member:: double opacity
Opacity of the layer (0.0 = transparent, 1.0 = opaque).
Expand All @@ -364,6 +418,14 @@ you can access everything.
Optional tint colour, encoded in an integer, 4 bytes: ARGB.

.. c:member:: int repeatx
Boolean, whether the image drawn by this layer is repeated along the X axis. (image layers only)

.. c:member:: int repeaty
Boolean, whether the image drawn by this layer is repeated along the Y axis. (image layers only)

.. c:member:: enum tmx_layer_type type
Type of layer, see :c:type:`tmx_layer_type`, tells you which member to use in :c:member:`tmx_layer.content`.
Expand Down Expand Up @@ -462,6 +524,10 @@ you can access everything.
Name of the tileset (user defined).

.. c:member:: char *class_type
Class of the tileset (user defined).

.. c:member:: unsigned int tile_width
The width of tiles in pixels.
Expand Down Expand Up @@ -498,6 +564,14 @@ you can access everything.
Image for this tileset, may be NULL if this tileset is a collection of single images (one image per tile).

.. c:member:: enum tmx_tile_render_size
Controls the size of tiles, see :c:type:`tmx_tile_render_size`.

.. c:member:: enum tmx_fill_mode
Controls how tiles scale, see :c:type:`tmx_fill_mode`.

.. c:member:: tmx_user_data user_data
Use that member to store your own data, see :c:type:`tmx_user_data`.
Expand Down Expand Up @@ -531,11 +605,19 @@ you can access everything.

.. c:member:: unsigned int ul_x
Upper-left x coordinate of this tile on the tileset image, irrelevant if the this tile has its own image.
Upper-left x coordinate of this tile on the tileset image, irrelevant if this tile has its own image.

.. c:member:: unsigned int ul_y
Upper-left y coordinate of this tile on the tileset image, irrelevant if the this tile has its own image.
Upper-left y coordinate of this tile on the tileset image, irrelevant if this tile has its own image.

.. c:member:: unsigned int width
Witdh of this tile on the tileset image, irrelevant if this tile has its own image.

.. c:member:: unsigned int height
Height of this tile on the tileset image, irrelevant if this tile has its own image.

.. c:member:: tmx_image *image
Expand Down Expand Up @@ -796,6 +878,10 @@ you can access everything.
Name of the property (user defined).

.. c:member:: char *propertytype
The name of the custom property type (user defined).

.. c:member:: enum tmx_property_type type
Type of the property (String, Boolean, Path, ...), see :c:type:`tmx_property_type`,
Expand Down Expand Up @@ -834,6 +920,14 @@ you can access everything.
Colour, encoded in an integer, 4 bytes: ARGB.

.. c:member:: int object_id
Object unique identifier, see :c:func:`tmx_find_object_by_id`.

.. c:member:: tmx_properties *properties
Members of a custom property type.

.. c:type:: union tmx_user_data
.. c:member:: int integer
Expand Down
8 changes: 8 additions & 0 deletions doc/src/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ Utilities
Get a layer by its name (user defined string, use with care, may not be unique), see :c:member:`tmx_layer.name`.
.. c:function:: tmx_object* tmx_find_object_by_id(const tmx_map *map, unsigned int id)
Get an object by its ID, see :c:member:`tmx_object.id`.
.. c:function:: tmx_tileset_list* tmx_find_tileset_by_name(const tmx_map* map, const char* name)
Get a tileset by its name (user defined string, use with care, may not be unique), see :c:member:`tmx_tileset.name`.
.. c:function:: tmx_property* tmx_get_property(tmx_properties *hash, const char *key)
Get a property by its name.
Expand Down

0 comments on commit 3d16ceb

Please sign in to comment.