Mercurial > molko
comparison src/core/message.h @ 70:53b217afe122
doc: improve doxygen documentation
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 27 Jan 2020 14:13:49 +0100 |
parents | 7187c0d9b9c0 |
children | 1aec066bcdae |
comparison
equal
deleted
inserted
replaced
69:5da49274e5fb | 70:53b217afe122 |
---|---|
20 #define MOLKO_MESSAGE_H | 20 #define MOLKO_MESSAGE_H |
21 | 21 |
22 /** | 22 /** |
23 * \file message.h | 23 * \file message.h |
24 * \brief Message dialog. | 24 * \brief Message dialog. |
25 * \ingroup actions | |
26 * | |
27 * This module's purpose is to show a dialog box into the screen to show text | |
28 * and optionally ask the user a question. | |
29 * | |
30 * By itself, it is very low level and does not prevent other parts of the game | |
31 * to use the input so you probably need to inhibit input if your dialog is | |
32 * meant to be displayed on a map. | |
33 * | |
34 * To use it use the following procedure: | |
35 * | |
36 * 1. Create a struct message object and set required properties, | |
37 * 2. Call \ref message_start to reset the state, | |
38 * 3. Call \ref message_handle and \ref message_update with appropriate values, | |
39 * 4. Call \ref message_draw to render the dialog. | |
40 * | |
41 * Depending on message flags or user input, step 3 may return true in this | |
42 * case you should stop using the message as it has completed rendering. | |
43 * | |
44 * \note All properties must exist until the object is no longer used. | |
45 * | |
46 * \code | |
47 * struct message msg = { | |
48 * // You can show up to 6 lines. | |
49 * .text = { | |
50 * "Hello, what's up?" | |
51 * }, | |
52 * // This image will be shown on the left as user face. | |
53 * .avatar = mysuperavatar, | |
54 * // This should point to a image that is used as background. | |
55 * .frame = mysuperframe, | |
56 * // The first color is normal text, the second is for selected text | |
57 * // in case of question. | |
58 * .colors = { 0xffffffff, 0x0000ffff }, | |
59 * // This indicates this message is a question. | |
60 * .flags = MESSAGE_QUESTION | |
61 * }; | |
62 * \endcode | |
25 */ | 63 */ |
26 | 64 |
27 #include <stdbool.h> | 65 #include <stdbool.h> |
28 | 66 |
29 struct action; | 67 struct action; |
57 * any user properties and therefore must exist while using it. | 95 * any user properties and therefore must exist while using it. |
58 */ | 96 */ |
59 struct message { | 97 struct message { |
60 const char *text[6]; /*!< (RW) Lines of text to show */ | 98 const char *text[6]; /*!< (RW) Lines of text to show */ |
61 struct texture *frame; /*!< (RW) Frame to use */ | 99 struct texture *frame; /*!< (RW) Frame to use */ |
62 struct texture *avatar; /*!< (RW) Optional avatar */ | 100 struct texture *avatar; /*!< (RW) Avatar face (optional) */ |
63 struct font *font; /*!< (RW) Font to use */ | 101 struct font *font; /*!< (RW) Font to use */ |
64 unsigned long colors[2]; /*!< (RW) Normal/selected colors */ | 102 unsigned long colors[2]; /*!< (RW) Normal/selected colors */ |
65 unsigned int index; /*!< (RW) Line selected */ | 103 unsigned int index; /*!< (RW) Line selected */ |
66 enum message_flags flags; /*!< (RW) Message flags */ | 104 enum message_flags flags; /*!< (RW) Message flags */ |
67 enum message_state state; /*!< (RO) Current state */ | 105 enum message_state state; /*!< (RO) Current state */ |