comparison libmlk-rpg/mlk/rpg/map.c @ 599:cb8ca73f1aa4

rpg: walksprite -> mlk_walksprite
author David Demelier <markand@malikania.fr>
date Fri, 31 Mar 2023 20:01:00 +0200
parents cdbc13ceff85
children 19707e3ad048
comparison
equal deleted inserted replaced
598:1742b5eaf0d4 599:cb8ca73f1aa4
172 172
173 /* Center the view by default. */ 173 /* Center the view by default. */
174 center(map); 174 center(map);
175 175
176 /* Final bits. */ 176 /* Final bits. */
177 walksprite_init(&map->player_ws, map->player_sprite, 150); 177 map->player_ws.sprite = map->player_sprite;
178 map->player_ws.delay = 150;
179 mlk_walksprite_init(&map->player_ws);
178 } 180 }
179 181
180 static void 182 static void
181 handle_keydown(struct mlk_map *map, const union mlk_event *event) 183 handle_keydown(struct mlk_map *map, const union mlk_event *event)
182 { 184 {
465 if (dx) 467 if (dx)
466 move_x(map, dx * delta); 468 move_x(map, dx * delta);
467 if (dy) 469 if (dy)
468 move_y(map, dy * delta); 470 move_y(map, dy * delta);
469 471
470 walksprite_update(&map->player_ws, ticks); 472 mlk_walksprite_update(&map->player_ws, ticks);
471 } 473 }
472 474
473 static inline void 475 static inline void
474 draw_layer_tile(const struct mlk_map *map, 476 draw_layer_tile(const struct mlk_map *map,
475 const struct mlk_map_layer *layer, 477 const struct mlk_map_layer *layer,
639 641
640 /* Draw the texture about background/foreground. */ 642 /* Draw the texture about background/foreground. */
641 draw_layer(map, &map->layers[MLK_MAP_LAYER_TYPE_BG]); 643 draw_layer(map, &map->layers[MLK_MAP_LAYER_TYPE_BG]);
642 draw_layer(map, &map->layers[MLK_MAP_LAYER_TYPE_FG]); 644 draw_layer(map, &map->layers[MLK_MAP_LAYER_TYPE_FG]);
643 645
644 walksprite_draw( 646 mlk_walksprite_draw(
645 &map->player_ws, 647 &map->player_ws,
646 map->player_a, 648 map->player_a,
647 map->player_x - map->view_x, 649 map->player_x - map->view_x,
648 map->player_y - map->view_y); 650 map->player_y - map->view_y);
649 651