From 7e4b6e7a14fce95361cf0c29ba6bcbf6d9ed4263 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Tue, 28 Feb 2012 23:16:55 +0100 Subject: [PATCH] moar docs --- TODO | 4 ++++ src/config.c | 14 +++++++++----- src/config.h | 5 +++++ src/main.h | 20 ++++++++++---------- 4 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 TODO diff --git a/TODO b/TODO new file mode 100644 index 0000000..743b3b5 --- /dev/null +++ b/TODO @@ -0,0 +1,4 @@ +- memory bitmaps for scaling big textures +- FPS independent timings +- moar documentation +- autodetect latencies on drawing when fading in menu diff --git a/src/config.c b/src/config.c index 8793138..2129f90 100644 --- a/src/config.c +++ b/src/config.c @@ -9,7 +9,9 @@ * Section CANNOT be declared multiple times. * * Lines starting with '#' are ignored. + * * All other lines have to look like this one: + * * key=value * * All whitespace at beginning, end or around '=' char will belong to key or value. @@ -27,15 +29,17 @@ #include #include +/*! \brief One config option in list of options. */ struct ConfigOption { - char* name; - char* value; - char* section; - struct ConfigOption *next; + char* name; /*!< Name of the config entry. */ + char* value; /*!< Value of the config entry. */ + char* section; /*!< Section of the config entry (including braces). */ + struct ConfigOption *next; /*!< Pointer to next option in list, or NULL if there is no more. */ }; -struct ConfigOption *config; +struct ConfigOption *config; /*!< Pointer to first config entry in list. */ +/*! \brief Adds new config entry. */ void AppendToConfig(char* section, char* name, char* value) { struct ConfigOption *new = malloc(sizeof(struct ConfigOption)); new->next = NULL; diff --git a/src/config.h b/src/config.h index 19d6ae2..fc6c52a 100644 --- a/src/config.h +++ b/src/config.h @@ -2,8 +2,13 @@ * \brief Configuration manager headers. */ +/*! \brief Reads config from file into memory. */ void InitConfig(); +/*! \brief Returns value of requested config entry. */ char* GetConfigOption(char* section, char* name); +/*! \brief Returns value of requested config entry, or def if no such entry exists. */ char* GetConfigOptionDefault(char* section, char* name, char* def); +/*! \brief Sets new value of requested config entry, or created new if no such entry exists. */ void SetConfigOption(char* section, char* name, char* value); +/*! \brief Writes config from memory to file. */ void DeinitConfig(); diff --git a/src/main.h b/src/main.h index 3f74c3f..55ccb2a 100644 --- a/src/main.h +++ b/src/main.h @@ -26,16 +26,16 @@ enum gamestate_enum { /*! \brief Resources used by Level state. */ struct Level { - ALLEGRO_BITMAP *fade_bitmap; - ALLEGRO_BITMAP *image; - ALLEGRO_BITMAP *derpy_walkcycle; - ALLEGRO_BITMAP *derpy; - ALLEGRO_BITMAP *derpytmp; - ALLEGRO_SAMPLE *sample; - int current_level; - int derpy_frame; - int derpy_frame_tmp; - double derpy_pos; + ALLEGRO_BITMAP *fade_bitmap; /*!< Bitmap used on fade-in and fade-out animations. */ + ALLEGRO_BITMAP *image; /*!< Background texture. */ + ALLEGRO_BITMAP *derpy_walkcycle; /*!< Derpy walk cycle spritesheet. */ + ALLEGRO_BITMAP *derpy; /*!< Derpy sprite. */ + ALLEGRO_BITMAP *derpytmp; /*!< Unscaled Derpy sprite. */ + ALLEGRO_SAMPLE *sample; /*!< Sample with background music. */ + int current_level; /*!< Level number. */ + int derpy_frame; /*!< Current frame of Derpy animation. */ + int derpy_frame_tmp; /*!< Counter used to slow down Derpy animation. */ + double derpy_pos; /*!< Position of Derpy on screen. */ }; /*! \brief Resources used by Menu state. */