comparison src/core/message.h @ 94:ed72843a7194

core: simplify font/texture interfaces Expose the structure to avoid calling functions and heap allocations. While here remove some useless functions.
author David Demelier <markand@malikania.fr>
date Mon, 30 Mar 2020 13:34:42 +0200
parents 6203e1ac9b18
children 4ac71ac10c9f
comparison
equal deleted inserted replaced
93:d4a72fa16225 94:ed72843a7194
63 * \endcode 63 * \endcode
64 */ 64 */
65 65
66 #include <stdbool.h> 66 #include <stdbool.h>
67 67
68 #include "texture.h"
69
68 struct action; 70 struct action;
69 struct font; 71 struct font;
70 struct texture;
71 72
72 union event; 73 union event;
73 74
74 /** 75 /**
75 * \brief Message flags. 76 * \brief Message flags.
96 * This structure is used to display a message into the screen. It does not own 97 * 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. 98 * any user properties and therefore must exist while using it.
98 */ 99 */
99 struct message { 100 struct message {
100 const char *text[6]; /*!< (RW) Lines of text to show */ 101 const char *text[6]; /*!< (RW) Lines of text to show */
101 struct texture *frame; /*!< (RW) Frame to use */ 102 struct texture *frame; /*!< (RW, ref) Frame to use */
102 struct texture *avatar; /*!< (RW) Avatar face (optional) */ 103 struct texture *avatar; /*!< (RW, ref, optional) Avatar face (optional) */
103 struct font *font; /*!< (RW) Font to use */ 104 struct font *font; /*!< (RW, ref) Font to use */
104 unsigned long colors[2]; /*!< (RW) Normal/selected colors */ 105 unsigned long colors[2]; /*!< (RW) Normal/selected colors */
105 unsigned int index; /*!< (RW) Line selected */ 106 unsigned int index; /*!< (RW) Line selected */
106 enum message_flags flags; /*!< (RW) Message flags */ 107 enum message_flags flags; /*!< (RW) Message flags */
107 enum message_state state; /*!< (RO) Current state */ 108 enum message_state state; /*!< (RO) Current state */
108 109
109 /*! \cond PRIVATE */ 110 /*! \cond PRIVATE */
110 111
111 struct texture *textures[12]; 112 struct texture textures[12];
112 unsigned int elapsed; 113 unsigned int elapsed;
113 int height[2]; 114 int height[2];
114 115
115 /*! \endcond */ 116 /*! \endcond */
116 }; 117 };