Mercurial > molko
annotate src/core/message.h @ 72:6203e1ac9b18
doc: improve doxygen documentation a lot
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 28 Jan 2020 14:02:45 +0100 |
parents | 1aec066bcdae |
children | ed72843a7194 |
rev | line source |
---|---|
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
1 /* |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
2 * message.h -- message dialog |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
3 * |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
4 * Copyright (c) 2020 David Demelier <markand@malikania.fr> |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
5 * |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
6 * Permission to use, copy, modify, and/or distribute this software for any |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
7 * purpose with or without fee is hereby granted, provided that the above |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
8 * copyright notice and this permission notice appear in all copies. |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
9 * |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
17 */ |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
18 |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
19 #ifndef MOLKO_MESSAGE_H |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
20 #define MOLKO_MESSAGE_H |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
21 |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
22 /** |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
23 * \file message.h |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
24 * \brief Message dialog. |
70
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
25 * \ingroup actions |
72
6203e1ac9b18
doc: improve doxygen documentation a lot
David Demelier <markand@malikania.fr>
parents:
71
diff
changeset
|
26 * \ingroup drawing |
70
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
27 * |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
28 * This module's purpose is to show a dialog box into the screen to show text |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
29 * and optionally ask the user a question. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
30 * |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
31 * By itself, it is very low level and does not prevent other parts of the game |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
32 * to use the input so you probably need to inhibit input if your dialog is |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
33 * meant to be displayed on a map. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
34 * |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
35 * To use it use the following procedure: |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
36 * |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
37 * 1. Create a struct message object and set required properties, |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
38 * 2. Call \ref message_start to reset the state, |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
39 * 3. Call \ref message_handle and \ref message_update with appropriate values, |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
40 * 4. Call \ref message_draw to render the dialog. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
41 * |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
42 * Depending on message flags or user input, step 3 may return true in this |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
43 * case you should stop using the message as it has completed rendering. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
44 * |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
45 * \note All properties must exist until the object is no longer used. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
46 * |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
47 * \code |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
48 * struct message msg = { |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
49 * // You can show up to 6 lines. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
50 * .text = { |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
51 * "Hello, what's up?" |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
52 * }, |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
53 * // This image will be shown on the left as user face. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
54 * .avatar = mysuperavatar, |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
55 * // This should point to a image that is used as background. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
56 * .frame = mysuperframe, |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
57 * // The first color is normal text, the second is for selected text |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
58 * // in case of question. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
59 * .colors = { 0xffffffff, 0x0000ffff }, |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
60 * // This indicates this message is a question. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
61 * .flags = MESSAGE_QUESTION |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
62 * }; |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
63 * \endcode |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
64 */ |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
65 |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
66 #include <stdbool.h> |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
67 |
67
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
68 struct action; |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
69 struct font; |
62 | 70 struct texture; |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
71 |
64
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
72 union event; |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
73 |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
74 /** |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
75 * \brief Message flags. |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
76 */ |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
77 enum message_flags { |
64
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
78 MESSAGE_AUTOMATIC = (1 << 0), /*!< Will automatically change state by itself. */ |
71
1aec066bcdae
core: allow quick message with MESSAGE_QUICK
David Demelier <markand@malikania.fr>
parents:
70
diff
changeset
|
79 MESSAGE_QUESTION = (1 << 1), /*!< The message is a question. */ |
1aec066bcdae
core: allow quick message with MESSAGE_QUICK
David Demelier <markand@malikania.fr>
parents:
70
diff
changeset
|
80 MESSAGE_QUICK = (1 << 2), /*!< Avoid animations. */ |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
81 }; |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
82 |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
83 /** |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
84 * \brief Message state. |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
85 */ |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
86 enum message_state { |
64
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
87 MESSAGE_NONE, /*!< Message hasn't start yet or is finished */ |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
88 MESSAGE_OPENING, /*!< Message animation is opening */ |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
89 MESSAGE_SHOWING, /*!< Message is displaying */ |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
90 MESSAGE_HIDING /*!< Message animation for hiding */ |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
91 }; |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
92 |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
93 /** |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
94 * \brief Message object. |
62 | 95 * |
96 * This structure is used to display a message into the screen. It does not own | |
97 * any user properties and therefore must exist while using it. | |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
98 */ |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
99 struct message { |
62 | 100 const char *text[6]; /*!< (RW) Lines of text to show */ |
101 struct texture *frame; /*!< (RW) Frame to use */ | |
70
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
102 struct texture *avatar; /*!< (RW) Avatar face (optional) */ |
62 | 103 struct font *font; /*!< (RW) Font to use */ |
64
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
104 unsigned long colors[2]; /*!< (RW) Normal/selected colors */ |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
105 unsigned int index; /*!< (RW) Line selected */ |
62 | 106 enum message_flags flags; /*!< (RW) Message flags */ |
107 enum message_state state; /*!< (RO) Current state */ | |
108 | |
64
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
109 /*! \cond PRIVATE */ |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
110 |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
111 struct texture *textures[12]; |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
112 unsigned int elapsed; |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
113 int height[2]; |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
114 |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
115 /*! \endcond */ |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
116 }; |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
117 |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
118 /** |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
119 * Start opening the message. This function will reset the message state and |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
120 * elapsed time. |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
121 * |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
122 * \pre msg != NULL |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
123 * \param msg the message |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
124 */ |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
125 void |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
126 message_start(struct message *msg); |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
127 |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
128 /** |
64
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
129 * Handle input events. |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
130 * |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
131 * This function will alter state of the message and change its selection in |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
132 * case of question. |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
133 * |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
134 * \pre msg != NULL |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
135 * \pre ev != NULL |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
136 * \param msg the message |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
137 * \param ev the event which occured |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
138 */ |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
139 void |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
140 message_handle(struct message *msg, const union event *ev); |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
141 |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
142 /** |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
143 * Update the message state and elapsed time.. |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
144 * |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
145 * \pre msg != NULL |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
146 * \param msg the message |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
147 * \param ticks the elapsed delay since last frame |
60
7266c750b649
core: simplify message
David Demelier <markand@malikania.fr>
parents:
59
diff
changeset
|
148 * \return true if it has finished |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
149 */ |
60
7266c750b649
core: simplify message
David Demelier <markand@malikania.fr>
parents:
59
diff
changeset
|
150 bool |
46
b815621df3e3
core: remove all fixed width integers, closes #2460
David Demelier <markand@malikania.fr>
parents:
24
diff
changeset
|
151 message_update(struct message *msg, unsigned int ticks); |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
152 |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
153 /** |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
154 * Draw the message into the screen. |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
155 * |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
156 * \pre msg != NULL |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
157 * \param msg the message |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
158 */ |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
159 void |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
160 message_draw(struct message *msg); |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
161 |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
162 /** |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
163 * Start hiding the message. |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
164 * |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
165 * \pre msg != NULL |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
166 * \param msg the message |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
167 * \note You should still continue to draw the message as the animation is not |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
168 * finished! |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
169 */ |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
170 void |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
171 message_hide(struct message *msg); |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
172 |
62 | 173 /** |
174 * Destroy owned resources. | |
175 * | |
176 * \pre msg != NULL | |
177 * \param msg the message | |
178 */ | |
179 void | |
180 message_finish(struct message *msg); | |
181 | |
67
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
182 /** |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
183 * Convert message into an action. |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
184 * |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
185 * \pre msg != NULL |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
186 * \pre action != NULL |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
187 * \param msg the message to copy from |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
188 * \param action the action to fill |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
189 */ |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
190 void |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
191 message_action(const struct message *msg, struct action *action); |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
192 |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
193 #endif /* !MOLKO_MESSAGE_H */ |