comparison 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
comparison
equal deleted inserted replaced
485:3ff1fe64d0cd 486:d6757c30658e
33 #include <mlk/ui/ui.h> 33 #include <mlk/ui/ui.h>
34 34
35 #include <mlk/rpg/message.h> 35 #include <mlk/rpg/message.h>
36 #include <mlk/rpg/rpg.h> 36 #include <mlk/rpg/rpg.h>
37 37
38 #define W (1280) 38 #include <mlk/example/example.h>
39 #define H (720) 39
40 40 #define MW (MLK_EXAMPLE_W * 0.75)
41 #define MW (W * 0.75) 41 #define MH (MLK_EXAMPLE_H * 0.120)
42 #define MH (H * 0.120) 42 #define MX ((MLK_EXAMPLE_W / 2) - (MW / 2))
43 #define MX ((W / 2) - (MW / 2))
44 #define MY (100) 43 #define MY (100)
45 44
46 static struct mlk_state *states[1]; 45 static struct mlk_state *states[1];
47 46
48 static void 47 static void
49 init(void) 48 init(void)
50 { 49 {
51 if (mlk_core_init("fr.malikania", "example-message") < 0 || ui_init() < 0 || rpg_init() < 0) 50 int err;
52 mlk_panic(); 51
53 if (mlk_window_open("Example - Message", W, H) < 0) 52 if ((err = mlk_example_init("example-message")) < 0)
54 mlk_panic(); 53 mlk_panicf("mlk_example_init: %s", mlk_err_string(err));
55 } 54 }
56 55
57 static void 56 static void
58 quit(void) 57 quit(void)
59 { 58 {