Mercurial > molko
comparison libmlk-ui/ui/debug.h @ 298:196264679079
misc: remove usage of bool
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 10 Mar 2021 18:49:08 +0100 |
parents | 08ab73b32832 |
children | d01e83210ca2 |
comparison
equal
deleted
inserted
replaced
297:6151152d009c | 298:196264679079 |
---|---|
17 */ | 17 */ |
18 | 18 |
19 #ifndef MOLKO_UI_DEBUG_H | 19 #ifndef MOLKO_UI_DEBUG_H |
20 #define MOLKO_UI_DEBUG_H | 20 #define MOLKO_UI_DEBUG_H |
21 | 21 |
22 /** | |
23 * \file debug.h | |
24 * \brief Debugging interfaces. | |
25 * | |
26 * This module provides functions to draw debugging information within the game | |
27 * window. It is mostly used for information only when state of the game is | |
28 * better inspected via direct window information rather than writing in the | |
29 * console. | |
30 * | |
31 * Predefined core states may print debugging information if | |
32 * debug_options.enabled variable is set to true. However, you need to specify | |
33 * the font to use in order to work. | |
34 * | |
35 * Each call to \ref debugf or \ref vdebugf automatically adjust | |
36 * next coordinate for rendering the text. As such, user may simply print | |
37 * several lines of text without having to deal with that manually. | |
38 */ | |
39 | |
40 #include <stdbool.h> | |
41 #include <stdarg.h> | 22 #include <stdarg.h> |
42 | 23 |
43 #include <core/core.h> | 24 #include <core/core.h> |
44 #include <core/font.h> | 25 #include <core/font.h> |
45 | 26 |
46 /** | |
47 * Maximum content length per report. | |
48 */ | |
49 #define DEBUG_LINE_MAX 1024 | 27 #define DEBUG_LINE_MAX 1024 |
50 | 28 |
51 struct theme; | 29 struct theme; |
52 | 30 |
53 /** | |
54 * \brief Debugging options. | |
55 * | |
56 * Fill this structure with appropriate values to change debugging behavior | |
57 * in core API. | |
58 */ | |
59 struct debug_options { | 31 struct debug_options { |
60 bool enable; /*!< (+) Enable core API debugging. */ | 32 int enable; |
61 }; | 33 }; |
62 | 34 |
63 /** | |
64 * \brief Debug context. | |
65 * | |
66 * Use this structure each time you need to print one or more messages. | |
67 */ | |
68 struct debug_report { | 35 struct debug_report { |
69 const struct theme *theme; /*!< (+&?) Theme to use. */ | 36 const struct theme *theme; |
70 unsigned int count; /*!< (-) Number of messages already printed. */ | 37 unsigned int count; |
71 }; | 38 }; |
72 | 39 |
73 CORE_BEGIN_DECLS | 40 CORE_BEGIN_DECLS |
74 | 41 |
75 /** | |
76 * Global debugging options. | |
77 */ | |
78 extern struct debug_options debug_options; | 42 extern struct debug_options debug_options; |
79 | 43 |
80 /** | |
81 * Print debugging information into the screen. | |
82 * | |
83 * \pre report != NULL | |
84 * \pre fmt != NULL | |
85 * \param report the reporting context | |
86 * \param fmt the printf(3) format string | |
87 * \note The message length must not exceed DEBUG_LINE_MAX, otherwise its | |
88 * result is truncated. | |
89 */ | |
90 void | 44 void |
91 debugf(struct debug_report *report, const char *fmt, ...); | 45 debugf(struct debug_report *, const char *, ...); |
92 | 46 |
93 /** | 47 |
94 * Similar to \ref debugf with a va_list arguments pointer. | |
95 * | |
96 * \pre fmt != NULL | |
97 * \param report the reporting context | |
98 * \param fmt the printf(3) format string | |
99 * \param ap the argument list | |
100 */ | |
101 void | 48 void |
102 vdebugf(struct debug_report *report, const char *fmt, va_list ap); | 49 vdebugf(struct debug_report *, const char *, va_list); |
103 | 50 |
104 CORE_END_DECLS | 51 CORE_END_DECLS |
105 | 52 |
106 #endif /* !MOLKO_UI_DEBUG_H */ | 53 #endif /* !MOLKO_UI_DEBUG_H */ |