Mercurial > molko
diff 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 |
line wrap: on
line diff
--- a/examples/example-trace/example-trace.c Tue Feb 28 08:40:35 2023 +0100 +++ b/examples/example-trace/example-trace.c Tue Feb 28 13:04:13 2023 +0100 @@ -17,6 +17,7 @@ */ #include <mlk/core/core.h> +#include <mlk/core/err.h> #include <mlk/core/event.h> #include <mlk/core/game.h> #include <mlk/core/sys.h> @@ -30,20 +31,18 @@ #include <mlk/ui/theme.h> #include <mlk/ui/ui.h> +#include <mlk/example/example.h> #include <mlk/example/trace-hud.h> -#define W 1280 -#define H 720 - static struct mlk_state *states[1]; static void init(void) { - if (mlk_core_init("fr.malikania", "example-trace") < 0 || ui_init() < 0) - mlk_panic(); - if (mlk_window_open("Example - Trace", W, H) < 0) - mlk_panic(); + int err; + + if ((err = mlk_example_init("example-trace")) < 0) + mlk_panicf("mlk_example_init: %s", mlk_err_string(err)); mlk_trace_handler = trace_hud_handler; }