comparison examples/example-tileset/example-tileset.c @ 629:fee7bd30725c

rpg: cleanup tileset-loader-file
author David Demelier <markand@malikania.fr>
date Sat, 26 Aug 2023 16:09:35 +0200
parents f9e85d0aca74
children bb67f935a93f
comparison
equal deleted inserted replaced
628:c2b62ff38224 629:fee7bd30725c
47 #include <mlk/example/example.h> 47 #include <mlk/example/example.h>
48 #include <mlk/example/registry.h> 48 #include <mlk/example/registry.h>
49 49
50 #include <assets/tilesets/world.h> 50 #include <assets/tilesets/world.h>
51 51
52 static struct mlk_tileset_loader loader; 52 static struct mlk_tileset_loader_file loader;
53 static struct mlk_tileset tileset; 53 static struct mlk_tileset tileset;
54 54
55 /* 55 /*
56 * This is only to demonstrate how we can custom-allocate data, you can skip 56 * This is only to demonstrate how we can custom-allocate data, you can skip
57 * that part. 57 * that part.
125 * 125 *
126 * Images are loaded from the libmlk-example registry from RAM and 126 * Images are loaded from the libmlk-example registry from RAM and
127 * sprites animations are statically allocated. 127 * sprites animations are statically allocated.
128 */ 128 */
129 mlk_tileset_loader_file_init(&loader, ""); 129 mlk_tileset_loader_file_init(&loader, "");
130 loader.new_texture = new_texture; 130 loader.iface.new_texture = new_texture;
131 loader.new_sprite = new_sprite; 131 loader.iface.new_sprite = new_sprite;
132 loader.new_animation = new_animation; 132 loader.iface.new_animation = new_animation;
133 133
134 if (mlk_tileset_loader_openmem(&loader, &tileset, assets_tilesets_world, sizeof (assets_tilesets_world)) < 0) 134 if (mlk_tileset_loader_openmem(&loader.iface, &tileset, assets_tilesets_world, sizeof (assets_tilesets_world)) < 0)
135 mlk_panic(); 135 mlk_panic();
136 } 136 }
137 137
138 static void 138 static void
139 handle(struct mlk_state *st, const union mlk_event *ev) 139 handle(struct mlk_state *st, const union mlk_event *ev)