Mercurial > molko
comparison examples/example-drawable/main.c @ 364:570ab19bf268
misc: start removing adventure from library
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sun, 24 Oct 2021 11:29:04 +0200 |
parents | cd8b87ddd1e7 |
children | 19782ea1cf4a |
comparison
equal
deleted
inserted
replaced
363:c74ab1bbedec | 364:570ab19bf268 |
---|---|
38 | 38 |
39 #include <ui/label.h> | 39 #include <ui/label.h> |
40 #include <ui/theme.h> | 40 #include <ui/theme.h> |
41 #include <ui/ui.h> | 41 #include <ui/ui.h> |
42 | 42 |
43 #include <assets/sprites/explosion.h> | |
44 | |
43 #define W 1280 | 45 #define W 1280 |
44 #define H 720 | 46 #define H 720 |
45 #define PATH(r) util_pathf("%s/%s", sys_dir(SYS_DIR_DATA), r) | |
46 | 47 |
47 static struct label help = { | 48 static struct label help = { |
48 .x = 10, | 49 .x = 10, |
49 .y = 10, | 50 .y = 10, |
50 .text = "Keys: <Esc> to reset. Click anywhere to spawn a drawable.", | 51 .text = "Keys: <Esc> to reset. Click anywhere to spawn a drawable.", |
74 panic(); | 75 panic(); |
75 if (window_open("Example - Drawable", W, H) < 0) | 76 if (window_open("Example - Drawable", W, H) < 0) |
76 panic(); | 77 panic(); |
77 | 78 |
78 /* 0: Explosion animation. */ | 79 /* 0: Explosion animation. */ |
79 if (image_open(&explosion_tex, PATH("sprites/explosion.png")) < 0) | 80 if (image_openmem(&explosion_tex, assets_sprites_explosion, sizeof (assets_sprites_explosion)) < 0) |
80 panic(); | 81 panic(); |
81 | 82 |
82 sprite_init(&explosion_sprite, &explosion_tex, 256, 256); | 83 sprite_init(&explosion_sprite, &explosion_tex, 256, 256); |
83 } | 84 } |
84 | 85 |