annotate librpg/rpg/message.h @ 148:c577c15df07f

misc: split libraries, closes #2496
author David Demelier <markand@malikania.fr>
date Thu, 15 Oct 2020 10:32:18 +0200
parents libcore/core/message.h@b386d25832c8
children fb306ed990f8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
148
c577c15df07f misc: split libraries, closes #2496
David Demelier <markand@malikania.fr>
parents: 147
diff changeset
68 #include <core/texture.h>
94
ed72843a7194 core: simplify font/texture interfaces
David Demelier <markand@malikania.fr>
parents: 72
diff changeset
69
67
7187c0d9b9c0 core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents: 64
diff changeset
70 struct action;
7187c0d9b9c0 core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents: 64
diff changeset
71 struct font;
99
4ac71ac10c9f core: start adding some UI elements
David Demelier <markand@malikania.fr>
parents: 94
diff changeset
72 struct theme;
24
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
73
64
da9b7462ab92 core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents: 62
diff changeset
74 union event;
da9b7462ab92 core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents: 62
diff changeset
75
24
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
76 /**
140
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
77 * \brief Default animation speed in milliseconds.
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
78 */
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
79 #define MESSAGE_DELAY_DEFAULT (150)
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
80
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
81 /**
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
82 * \brief Default timeout in milliseconds for automatic messages.
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
83 */
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
84 #define MESSAGE_TIMEOUT_DEFAULT (5000)
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
85
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
86 /**
24
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
87 * \brief Message flags.
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
88 */
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
89 enum message_flags {
140
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
90 MESSAGE_FLAGS_AUTOMATIC = (1 << 0), /*!< Will automatically change state by itself. */
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
91 MESSAGE_FLAGS_QUESTION = (1 << 1), /*!< The message is a question. */
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
92 MESSAGE_FLAGS_FADEIN = (1 << 2), /*!< Animate opening. */
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
93 MESSAGE_FLAGS_FADEOUT = (1 << 3) /*!< Animate closing. */
24
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
94 };
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
95
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 * \brief Message state.
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 enum message_state {
140
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
100 MESSAGE_STATE_NONE, /*!< Message hasn't start yet or is finished */
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
101 MESSAGE_STATE_OPENING, /*!< Message animation is opening */
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
102 MESSAGE_STATE_SHOWING, /*!< Message is displaying */
453651d76f7c core: upgrade message in terms of customization
David Demelier <markand@malikania.fr>
parents: 136
diff changeset
103 MESSAGE_STATE_HIDING /*!< Message animation for hiding */
24
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
104 };
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
105
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
106 /**
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
107 * \brief Message object.
62
d07acc6ee4d9 core: improve message
David Demelier <markand@malikania.fr>
parents: 60
diff changeset
108 *
d07acc6ee4d9 core: improve message
David Demelier <markand@malikania.fr>
parents: 60
diff changeset
109 * This structure is used to display a message into the screen. It does not own
d07acc6ee4d9 core: improve message
David Demelier <markand@malikania.fr>
parents: 60
diff changeset
110 * 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
111 */
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
112 struct message {
147
b386d25832c8 doc: use new nomenclature, closes #2497
David Demelier <markand@malikania.fr>
parents: 141
diff changeset
113 int x; /*!< (+) Position in x. */
b386d25832c8 doc: use new nomenclature, closes #2497
David Demelier <markand@malikania.fr>
parents: 141
diff changeset
114 int y; /*!< (+) Position in y. */
b386d25832c8 doc: use new nomenclature, closes #2497
David Demelier <markand@malikania.fr>
parents: 141
diff changeset
115 unsigned int w; /*!< (+) Width. */
b386d25832c8 doc: use new nomenclature, closes #2497
David Demelier <markand@malikania.fr>
parents: 141
diff changeset
116 unsigned int h; /*!< (+) Height. */
b386d25832c8 doc: use new nomenclature, closes #2497
David Demelier <markand@malikania.fr>
parents: 141
diff changeset
117 unsigned int delay; /*!< (+) Delay for animations. */
b386d25832c8 doc: use new nomenclature, closes #2497
David Demelier <markand@malikania.fr>
parents: 141
diff changeset
118 unsigned int timeout; /*!< (+) Timeout in milliseconds. */
b386d25832c8 doc: use new nomenclature, closes #2497
David Demelier <markand@malikania.fr>
parents: 141
diff changeset
119 const char *text[6]; /*!< (+) Lines of text to show. */
b386d25832c8 doc: use new nomenclature, closes #2497
David Demelier <markand@malikania.fr>
parents: 141
diff changeset
120 struct texture *avatar; /*!< (+&?) Avatar face. */
b386d25832c8 doc: use new nomenclature, closes #2497
David Demelier <markand@malikania.fr>
parents: 141
diff changeset
121 unsigned int index; /*!< (+) Line selected */
b386d25832c8 doc: use new nomenclature, closes #2497
David Demelier <markand@malikania.fr>
parents: 141
diff changeset
122 enum message_flags flags; /*!< (+) Message flags */
b386d25832c8 doc: use new nomenclature, closes #2497
David Demelier <markand@malikania.fr>
parents: 141
diff changeset
123 enum message_state state; /*!< (-) Current state */
b386d25832c8 doc: use new nomenclature, closes #2497
David Demelier <markand@malikania.fr>
parents: 141
diff changeset
124 struct theme *theme; /*!< (+&?) Theme to use. */
b386d25832c8 doc: use new nomenclature, closes #2497
David Demelier <markand@malikania.fr>
parents: 141
diff changeset
125 unsigned int elapsed; /*!< (-) Time elapsed. */
b386d25832c8 doc: use new nomenclature, closes #2497
David Demelier <markand@malikania.fr>
parents: 141
diff changeset
126 double scale; /*!< (-) Current scale [0-1]. */
24
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
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
129 /**
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
130 * 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
131 * elapsed time.
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
132 *
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
133 * \pre msg != NULL
141
4eeeccf2b732 core: add trace/vtrace functions, closes #2493
David Demelier <markand@malikania.fr>
parents: 140
diff changeset
134 * \pre msg->delay > 0 if msg->flags contains MESSAGE_FLAGS_FADEIN or
4eeeccf2b732 core: add trace/vtrace functions, closes #2493
David Demelier <markand@malikania.fr>
parents: 140
diff changeset
135 * MESSAGE_FLAGS_FADEOUT
24
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
136 * \param msg the message
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
137 */
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
138 void
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
139 message_start(struct message *msg);
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
140
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
141 /**
64
da9b7462ab92 core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents: 62
diff changeset
142 * Handle input events.
da9b7462ab92 core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents: 62
diff changeset
143 *
da9b7462ab92 core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents: 62
diff changeset
144 * 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
145 * case of question.
da9b7462ab92 core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents: 62
diff changeset
146 *
da9b7462ab92 core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents: 62
diff changeset
147 * \pre msg != NULL
da9b7462ab92 core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents: 62
diff changeset
148 * \pre ev != NULL
da9b7462ab92 core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents: 62
diff changeset
149 * \param msg the message
da9b7462ab92 core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents: 62
diff changeset
150 * \param ev the event which occured
da9b7462ab92 core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents: 62
diff changeset
151 */
da9b7462ab92 core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents: 62
diff changeset
152 void
da9b7462ab92 core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents: 62
diff changeset
153 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
154
da9b7462ab92 core: implement question, closes #2464 @2h
David Demelier <markand@malikania.fr>
parents: 62
diff changeset
155 /**
24
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
156 * 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
157 *
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
158 * \pre msg != NULL
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
159 * \param msg the message
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
160 * \param ticks the elapsed delay since last frame
60
7266c750b649 core: simplify message
David Demelier <markand@malikania.fr>
parents: 59
diff changeset
161 * \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
162 */
60
7266c750b649 core: simplify message
David Demelier <markand@malikania.fr>
parents: 59
diff changeset
163 bool
46
b815621df3e3 core: remove all fixed width integers, closes #2460
David Demelier <markand@malikania.fr>
parents: 24
diff changeset
164 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
165
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
166 /**
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
167 * Draw the message into the screen.
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
168 *
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
169 * \pre msg != NULL
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
170 * \param msg the message
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
171 */
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
172 void
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
173 message_draw(struct message *msg);
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
174
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
175 /**
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
176 * Start hiding the message.
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
177 *
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
178 * \pre msg != NULL
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
179 * \param msg the message
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
180 * \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
181 * finished!
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
182 */
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
183 void
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
184 message_hide(struct message *msg);
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
185
62
d07acc6ee4d9 core: improve message
David Demelier <markand@malikania.fr>
parents: 60
diff changeset
186 /**
67
7187c0d9b9c0 core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents: 64
diff changeset
187 * Convert message into an action.
7187c0d9b9c0 core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents: 64
diff changeset
188 *
7187c0d9b9c0 core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents: 64
diff changeset
189 * \pre msg != NULL
7187c0d9b9c0 core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents: 64
diff changeset
190 * \pre action != NULL
136
30b68089ae70 core: rework actions and a bit of drawables, closes #2492
David Demelier <markand@malikania.fr>
parents: 121
diff changeset
191 * \param msg the message to reference
67
7187c0d9b9c0 core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents: 64
diff changeset
192 * \param action the action to fill
7187c0d9b9c0 core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents: 64
diff changeset
193 */
7187c0d9b9c0 core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents: 64
diff changeset
194 void
136
30b68089ae70 core: rework actions and a bit of drawables, closes #2492
David Demelier <markand@malikania.fr>
parents: 121
diff changeset
195 message_action(struct message *msg, struct action *action);
67
7187c0d9b9c0 core: implement message action, closes #2467
David Demelier <markand@malikania.fr>
parents: 64
diff changeset
196
24
4a06503641eb core: start basic implementation of dialog, continue #2449 @2h
David Demelier <markand@malikania.fr>
parents:
diff changeset
197 #endif /* !MOLKO_MESSAGE_H */