comparison examples/example-trace/example-trace.c @ 486:d6757c30658e

core: rework errors
author David Demelier <markand@malikania.fr>
date Tue, 28 Feb 2023 13:04:13 +0100
parents 3ff1fe64d0cd
children 8d5a266a1774
comparison
equal deleted inserted replaced
485:3ff1fe64d0cd 486:d6757c30658e
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 17 */
18 18
19 #include <mlk/core/core.h> 19 #include <mlk/core/core.h>
20 #include <mlk/core/err.h>
20 #include <mlk/core/event.h> 21 #include <mlk/core/event.h>
21 #include <mlk/core/game.h> 22 #include <mlk/core/game.h>
22 #include <mlk/core/sys.h> 23 #include <mlk/core/sys.h>
23 #include <mlk/core/window.h> 24 #include <mlk/core/window.h>
24 #include <mlk/core/painter.h> 25 #include <mlk/core/painter.h>
28 #include <mlk/core/util.h> 29 #include <mlk/core/util.h>
29 30
30 #include <mlk/ui/theme.h> 31 #include <mlk/ui/theme.h>
31 #include <mlk/ui/ui.h> 32 #include <mlk/ui/ui.h>
32 33
34 #include <mlk/example/example.h>
33 #include <mlk/example/trace-hud.h> 35 #include <mlk/example/trace-hud.h>
34
35 #define W 1280
36 #define H 720
37 36
38 static struct mlk_state *states[1]; 37 static struct mlk_state *states[1];
39 38
40 static void 39 static void
41 init(void) 40 init(void)
42 { 41 {
43 if (mlk_core_init("fr.malikania", "example-trace") < 0 || ui_init() < 0) 42 int err;
44 mlk_panic(); 43
45 if (mlk_window_open("Example - Trace", W, H) < 0) 44 if ((err = mlk_example_init("example-trace")) < 0)
46 mlk_panic(); 45 mlk_panicf("mlk_example_init: %s", mlk_err_string(err));
47 46
48 mlk_trace_handler = trace_hud_handler; 47 mlk_trace_handler = trace_hud_handler;
49 } 48 }
50 49
51 static void 50 static void