changeset 22:5519ad48822e

doc: add Doxygen documentation, closes #2450
author David Demelier <markand@malikania.fr>
date Thu, 09 Jan 2020 20:48:01 +0100
parents 63eaec5ceba9
children bc9637a2601b
files .hgignore Makefile doxygen/Doxyfile src/animation.h src/clock.h src/event.h src/image.h src/sprite.h src/texture.h
diffstat 9 files changed, 74 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Thu Jan 09 20:25:16 2020 +0100
+++ b/.hgignore	Thu Jan 09 20:48:01 2020 +0100
@@ -14,3 +14,8 @@
 ^tests/test-color$
 \.d$
 \.o$
+
+# doxygen stuff.
+^doxygen/html$
+^doxygen/man$
+^doxygen/doxygen_sqlite3\.db$
--- a/Makefile	Thu Jan 09 20:25:16 2020 +0100
+++ b/Makefile	Thu Jan 09 20:48:01 2020 +0100
@@ -78,10 +78,13 @@
 tools/molko-map: tools/molko-map.c
 	${CC} -o $@ $< ${CFLAGS} ${EXPAT_CFLAGS} ${EXPAT_LDFLAGS}
 
+doxygen:
+	doxygen doxygen/Doxyfile
+
 clean:
 	rm -f ${PROG} src/main.o src/main.d
 	rm -f ${LIB} ${OBJS} ${DEPS}
 	rm -f ${TESTS_OBJS} ${TESTS_DEPS}
 	rm -f ${TOOLS_OBJS} ${TOOLS_DEPS}
 
-.PHONY: clean tests tools
+.PHONY: clean doxygen tests tools
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doxygen/Doxyfile	Thu Jan 09 20:48:01 2020 +0100
@@ -0,0 +1,38 @@
+#
+# Doxyfile -- generate API documentation for Molko's Adventure
+#
+# Copyright (c) 2020 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+DOXYFILE_ENCODING      = UTF-8
+PROJECT_NAME           = "Molko's Adventure"
+PROJECT_NUMBER         = "0.1.0"
+PROJECT_BRIEF          = "2D RPG game in C"
+PROJECT_LOGO           =
+OUTPUT_DIRECTORY       = doxygen
+ALLOW_UNICODE_NAMES    = YES
+STRIP_FROM_PATH        = src
+TAB_SIZE               = 8
+OPTIMIZE_OUTPUT_FOR_C  = YES
+AUTOLINK_SUPPORT       = NO
+QUIET                  = YES
+WARNINGS               = YES
+INPUT                  = src
+INPUT_ENCODING         = UTF-8
+FILE_PATTERNS          = *.h
+RECURSIVE              = YES
+EXCLUDE_PATTERNS       = *_p.h
+GENERATE_LATEX         = NO
+GENERATE_MAN           = YES
--- a/src/animation.h	Thu Jan 09 20:25:16 2020 +0100
+++ b/src/animation.h	Thu Jan 09 20:48:01 2020 +0100
@@ -33,11 +33,11 @@
  * \brief Animation object
  */
 struct animation {
-	struct sprite *sprite;  /* Sprite to use (RW) */
-	uint16_t row;           /* current row (RO) */
-	uint16_t column;        /* current column (RO) */
-	uint16_t delay;         /* delay between frames (RW) */
-	uint16_t elapsed;       /* elapsed time since last frame (RO) */
+	struct sprite *sprite;  /*!< Sprite to use (RW) */
+	uint16_t row;           /*!< current row (RO) */
+	uint16_t column;        /*!< current column (RO) */
+	uint16_t delay;         /*!< delay between frames (RW) */
+	uint16_t elapsed;       /*!< elapsed time since last frame (RO) */
 };
 
 /**
--- a/src/clock.h	Thu Jan 09 20:25:16 2020 +0100
+++ b/src/clock.h	Thu Jan 09 20:48:01 2020 +0100
@@ -30,7 +30,7 @@
  * \brief Clock structure.
  */
 struct clock {
-	uint64_t ticks;         /* time point on initialization */
+	uint64_t ticks;         /*!< time point on initialization */
 };
 
 /**
--- a/src/event.h	Thu Jan 09 20:25:16 2020 +0100
+++ b/src/event.h	Thu Jan 09 20:48:01 2020 +0100
@@ -48,11 +48,17 @@
 union event {
 	enum event_type type;                   /*!< Which kind of event */
 
+        /**
+         * Store key down/up event.
+         */
 	struct {
 		enum event_type type;           /*!< EVENT_KEYDOWN or EVENT_KEYUP */
 		enum key key;                   /*!< Which key */
 	} key;
 
+        /**
+         * Store mouse motion event.
+         */
 	struct {
 		enum event_type type;           /*!< EVENT_MOUSE */
 		enum mouse_button buttons;      /*!< OR'ed buttons that are pressed */
@@ -60,6 +66,9 @@
 		int32_t y;                      /*!< Mouse position in y */
 	} mouse;
 
+        /**
+         * Store mouse click event.
+         */
 	struct {
 		enum event_type type;           /*!< EVENT_CLICKDOWN or EVENT_CLICKUP */
 		enum mouse_button button;       /*!< Unique button that was pressed */
--- a/src/image.h	Thu Jan 09 20:25:16 2020 +0100
+++ b/src/image.h	Thu Jan 09 20:48:01 2020 +0100
@@ -42,8 +42,8 @@
  * Open a file from a memory buffer.
  *
  * \pre buffer != NULL
- * \param the memory buffer
- * \return size the memory size
+ * \param buffer the memory buffer
+ * \param size the memory size
  * \return the texture or NULL on error
  */
 struct texture *
--- a/src/sprite.h	Thu Jan 09 20:25:16 2020 +0100
+++ b/src/sprite.h	Thu Jan 09 20:48:01 2020 +0100
@@ -32,11 +32,11 @@
  * \brief Sprite structure.
  */
 struct sprite {
-	struct texture *texture;        /* Texture to access (RO) */
-	uint16_t cellw;                 /* Width per cell (RW) */
-	uint16_t cellh;                 /* Height per cell (RW) */
-	uint16_t nrows;                 /* Number of rows (RW) */
-	uint16_t ncols;                 /* Number of columns (RW) */
+	struct texture *texture;        /*!< Texture to access (RO) */
+	uint16_t cellw;                 /*!< Width per cell (RW) */
+	uint16_t cellh;                 /*!< Height per cell (RW) */
+	uint16_t nrows;                 /*!< Number of rows (RW) */
+	uint16_t ncols;                 /*!< Number of columns (RW) */
 };
 
 /**
@@ -68,6 +68,7 @@
  * Draw the sprite component from row `r' and column `c'.
  *
  * \pre sprite != NULL
+ * \param sprite the sprite to draw
  * \param r the row number
  * \param c the column number
  * \param x the X destination
--- a/src/texture.h	Thu Jan 09 20:25:16 2020 +0100
+++ b/src/texture.h	Thu Jan 09 20:48:01 2020 +0100
@@ -52,12 +52,12 @@
  * \param tex the texture
  * \param src_x the source rectangle X coordinate
  * \param src_y the source rectangle Y coordinate
- * \param src_width the source rectangle width
- * \param src_height the source rectangle height
+ * \param src_w the source rectangle width
+ * \param src_h the source rectangle height
  * \param dst_x the destination rectangle X coordinate
  * \param dst_y the destination rectangle Y coordinate
- * \param dst_width the destination rectangle width
- * \param dst_height the destination rectangle height
+ * \param dst_w the destination rectangle width
+ * \param dst_h the destination rectangle height
  * \param angle the angle
  */
 void