Mercurial > molko
annotate 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 |
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 |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
26 * |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
27 * 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
|
28 * and optionally ask the user a question. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
29 * |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
30 * 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
|
31 * 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
|
32 * meant to be displayed on a map. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
33 * |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
34 * To use it use the following procedure: |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
35 * |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
36 * 1. Create a struct message object and set required properties, |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
37 * 2. Call \ref message_start to reset the state, |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
38 * 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
|
39 * 4. Call \ref message_draw to render the dialog. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
40 * |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
41 * 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
|
42 * 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
|
43 * |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
44 * \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
|
45 * |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
46 * \code |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
47 * struct message msg = { |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
48 * // You can show up to 6 lines. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
49 * .text = { |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
50 * "Hello, what's up?" |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
51 * }, |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
52 * // 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
|
53 * .avatar = mysuperavatar, |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
54 * // 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
|
55 * .frame = mysuperframe, |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
56 * // 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
|
57 * // in case of question. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
58 * .colors = { 0xffffffff, 0x0000ffff }, |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
59 * // This indicates this message is a question. |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
60 * .flags = MESSAGE_QUESTION |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
61 * }; |
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
62 * \endcode |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
63 */ |
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 #include <stdbool.h> |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
66 |
67
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
67 struct action; |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
68 struct font; |
62 | 69 struct texture; |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
70 |
64
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
71 union event; |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
72 |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
73 /** |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
74 * \brief Message flags. |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
75 */ |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
76 enum message_flags { |
64
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
77 MESSAGE_AUTOMATIC = (1 << 0), /*!< Will automatically change state by itself. */ |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
78 MESSAGE_QUESTION = (1 << 1) /*!< The message is a question. */ |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
79 }; |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
80 |
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 * \brief Message state. |
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 enum message_state { |
64
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
85 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
|
86 MESSAGE_OPENING, /*!< Message animation is opening */ |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
87 MESSAGE_SHOWING, /*!< Message is displaying */ |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
88 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
|
89 }; |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
90 |
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 * \brief Message object. |
62 | 93 * |
94 * This structure is used to display a message into the screen. It does not own | |
95 * 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
|
96 */ |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
97 struct message { |
62 | 98 const char *text[6]; /*!< (RW) Lines of text to show */ |
99 struct texture *frame; /*!< (RW) Frame to use */ | |
70
53b217afe122
doc: improve doxygen documentation
David Demelier <markand@malikania.fr>
parents:
67
diff
changeset
|
100 struct texture *avatar; /*!< (RW) Avatar face (optional) */ |
62 | 101 struct font *font; /*!< (RW) Font to use */ |
64
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
102 unsigned long colors[2]; /*!< (RW) Normal/selected colors */ |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
103 unsigned int index; /*!< (RW) Line selected */ |
62 | 104 enum message_flags flags; /*!< (RW) Message flags */ |
105 enum message_state state; /*!< (RO) Current state */ | |
106 | |
64
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
107 /*! \cond PRIVATE */ |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
108 |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
109 struct texture *textures[12]; |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
110 unsigned int elapsed; |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
111 int height[2]; |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
112 |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
113 /*! \endcond */ |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
114 }; |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
115 |
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 * 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
|
118 * elapsed time. |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
119 * |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
120 * \pre msg != NULL |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
121 * \param msg the message |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
122 */ |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
123 void |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
124 message_start(struct message *msg); |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
125 |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
126 /** |
64
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
127 * Handle input events. |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
128 * |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
129 * 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
|
130 * case of question. |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
131 * |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
132 * \pre msg != NULL |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
133 * \pre ev != NULL |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
134 * \param msg the message |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
135 * \param ev the event which occured |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
136 */ |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
137 void |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
138 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
|
139 |
da9b7462ab92
core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents:
62
diff
changeset
|
140 /** |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
141 * 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
|
142 * |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
143 * \pre msg != NULL |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
144 * \param msg the message |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
145 * \param ticks the elapsed delay since last frame |
60
7266c750b649
core: simplify message
David Demelier <markand@malikania.fr>
parents:
59
diff
changeset
|
146 * \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
|
147 */ |
60
7266c750b649
core: simplify message
David Demelier <markand@malikania.fr>
parents:
59
diff
changeset
|
148 bool |
46
b815621df3e3
core: remove all fixed width integers, closes #2460
David Demelier <markand@malikania.fr>
parents:
24
diff
changeset
|
149 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
|
150 |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
151 /** |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
152 * Draw the message into the screen. |
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 * \pre msg != NULL |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
155 * \param msg the message |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
156 */ |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
157 void |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
158 message_draw(struct message *msg); |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
159 |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
160 /** |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
161 * Start hiding the message. |
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 * \pre msg != NULL |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
164 * \param msg the message |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
165 * \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
|
166 * finished! |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
167 */ |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
168 void |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
169 message_hide(struct message *msg); |
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
170 |
62 | 171 /** |
172 * Destroy owned resources. | |
173 * | |
174 * \pre msg != NULL | |
175 * \param msg the message | |
176 */ | |
177 void | |
178 message_finish(struct message *msg); | |
179 | |
67
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
180 /** |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
181 * Convert message into an action. |
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 * \pre msg != NULL |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
184 * \pre action != NULL |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
185 * \param msg the message to copy from |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
186 * \param action the action to fill |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
187 */ |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
188 void |
7187c0d9b9c0
core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents:
64
diff
changeset
|
189 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
|
190 |
24
4a06503641eb
core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
191 #endif /* !MOLKO_MESSAGE_H */ |