Mercurial > molko
diff libmlk-core/core/state.h @ 253:c4da052c0def
core: goodbye doxygen
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 03 Dec 2020 09:06:52 +0100 |
parents | 71b3b7036de7 |
children | 08ab73b32832 |
line wrap: on
line diff
--- a/libmlk-core/core/state.h Tue Dec 01 21:53:23 2020 +0100 +++ b/libmlk-core/core/state.h Thu Dec 03 09:06:52 2020 +0100 @@ -19,136 +19,33 @@ #ifndef MOLKO_CORE_STATE_H #define MOLKO_CORE_STATE_H -/** - * \file state.h - * \brief Abstract state. - * \ingroup states - * - * The state module is a facility that allows changing game context with ease - * using a single \ref game_switch routine. - * - * The user creates any state required, set appropriate functions if needed and - * place them in the game using \ref game_switch. Then function \ref game_handle - * \ref game_update and finally \ref game_draw. - */ - union event; -/** - * \brief Abstract state. - */ struct state { - /** - * (+&?) Optional user data. - */ void *data; - - /** - * (+?) This function is called when the state is about to begin. - * - * \param state this state - */ void (*start)(struct state *state); - - /** - * (+) This function is called for each event that happened. - * - * \param state this state - * \param ev the event - */ void (*handle)(struct state *state, const union event *ev); - - /** - * (+) Update the state. - * - * This function is called to update the game, with the number of - * milliseconds since the last frame. - * - * \param state this state - * \param ev the event - */ void (*update)(struct state *state, unsigned int ticks); - - /** - * (+) This function is supposed to draw the game. - * - * \param state this state - */ void (*draw)(struct state *state); - - /** - * (+?) This function is called when the state is about to be switched - * away from. - * - * This function is not called in case `quick` is set to true when - * calling \ref game_switch function. - * - * \param state this state - */ void (*end)(struct state *state); - - /** - * (+?) This function is called to close resources if necessary. - * - * \param state the state - */ void (*finish)(struct state *state); }; -/** - * Shortcut for state->start (if not NULL) - * - * \pre state != NULL - * \param state the state - */ void state_start(struct state *state); -/** - * Shortcut for state->handle (if not NULL) - * - * \pre state != NULL - * \pre ev != NULL - * \param state the state - * \param ev the event - */ void state_handle(struct state *state, const union event *ev); -/** - * Shortcut for state->update (if not NULL) - * - * \pre state != NULL - * \param state the state - * \param ticks elapsed milliseconds since last frame - */ void state_update(struct state *state, unsigned int ticks); -/** - * Shortcut for state->draw (if not NULL) - * - * \pre state != NULL - * \param state the state - */ void state_draw(struct state *state); -/** - * Shortcut for state->end (if not NULL) - * - * \pre state != NULL - * \param state the state - */ void state_end(struct state *state); -/** - * Shortcut for state->finish (if not NULL) - * - * \pre state != NULL - * \param state the state - */ void state_finish(struct state *state);