Mercurial > molko
diff examples/example-message/example-message.c @ 486:d6757c30658e
core: rework errors
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 28 Feb 2023 13:04:13 +0100 |
parents | 3ff1fe64d0cd |
children | 734b598534c4 |
line wrap: on
line diff
--- a/examples/example-message/example-message.c Tue Feb 28 08:40:35 2023 +0100 +++ b/examples/example-message/example-message.c Tue Feb 28 13:04:13 2023 +0100 @@ -35,12 +35,11 @@ #include <mlk/rpg/message.h> #include <mlk/rpg/rpg.h> -#define W (1280) -#define H (720) +#include <mlk/example/example.h> -#define MW (W * 0.75) -#define MH (H * 0.120) -#define MX ((W / 2) - (MW / 2)) +#define MW (MLK_EXAMPLE_W * 0.75) +#define MH (MLK_EXAMPLE_H * 0.120) +#define MX ((MLK_EXAMPLE_W / 2) - (MW / 2)) #define MY (100) static struct mlk_state *states[1]; @@ -48,10 +47,10 @@ static void init(void) { - if (mlk_core_init("fr.malikania", "example-message") < 0 || ui_init() < 0 || rpg_init() < 0) - mlk_panic(); - if (mlk_window_open("Example - Message", W, H) < 0) - mlk_panic(); + int err; + + if ((err = mlk_example_init("example-message")) < 0) + mlk_panicf("mlk_example_init: %s", mlk_err_string(err)); } static void