changeset 448:0c4cd552879d

core: animation -> mlk_animation
author David Demelier <markand@malikania.fr>
date Sat, 18 Feb 2023 13:06:04 +0100
parents e1fa1b867281
children f2f0e73ea9da
files libmlk-core/mlk/core/animation.c libmlk-core/mlk/core/animation.h libmlk-rpg/mlk/rpg/battle-entity-state-attacking.c libmlk-rpg/mlk/rpg/battle-entity-state-attacking.h libmlk-rpg/mlk/rpg/tileset-file.c libmlk-rpg/mlk/rpg/tileset.c libmlk-rpg/mlk/rpg/tileset.h
diffstat 7 files changed, 29 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/libmlk-core/mlk/core/animation.c	Sat Feb 18 12:43:05 2023 +0100
+++ b/libmlk-core/mlk/core/animation.c	Sat Feb 18 13:06:04 2023 +0100
@@ -26,17 +26,17 @@
 static int
 update(struct drawable *dw, unsigned int ticks)
 {
-	return animation_update(dw->data, ticks);
+	return mlk_animation_update(dw->data, ticks);
 }
 
 static void
 draw(struct drawable *dw)
 {
-	animation_draw(dw->data, dw->x, dw->y);
+	mlk_animation_draw(dw->data, dw->x, dw->y);
 }
 
 void
-animation_init(struct animation *an, const struct sprite *sprite, unsigned int delay)
+mlk_animation_init(struct mlk_animation *an, const struct sprite *sprite, unsigned int delay)
 {
 	assert(an);
 	assert(sprite);
@@ -49,7 +49,7 @@
 }
 
 void
-animation_start(struct animation *an)
+mlk_animation_start(struct mlk_animation *an)
 {
 	assert(an);
 
@@ -59,7 +59,7 @@
 }
 
 int
-animation_completed(const struct animation *an)
+mlk_animation_completed(const struct mlk_animation *an)
 {
 	assert(an);
 
@@ -69,7 +69,7 @@
 }
 
 int
-animation_update(struct animation *an, unsigned int ticks)
+mlk_animation_update(struct mlk_animation *an, unsigned int ticks)
 {
 	assert(an);
 
@@ -91,11 +91,11 @@
 	} else
 		an->elapsed = 0;
 
-	return animation_completed(an);
+	return mlk_animation_completed(an);
 }
 
 int
-animation_draw(const struct animation *an, int x, int y)
+mlk_animation_draw(const struct mlk_animation *an, int x, int y)
 {
 	assert(an);
 
@@ -103,7 +103,7 @@
 }
 
 void
-animation_drawable(struct animation *an, struct drawable *dw, int x, int y)
+mlk_animation_drawable(struct mlk_animation *an, struct drawable *dw, int x, int y)
 {
 	assert(an);
 	assert(dw);
@@ -116,5 +116,5 @@
 	dw->update = update;
 	dw->draw = draw;
 
-	animation_start(an);
+	mlk_animation_start(an);
 }
--- a/libmlk-core/mlk/core/animation.h	Sat Feb 18 12:43:05 2023 +0100
+++ b/libmlk-core/mlk/core/animation.h	Sat Feb 18 13:06:04 2023 +0100
@@ -24,7 +24,7 @@
 struct drawable;
 struct sprite;
 
-struct animation {
+struct mlk_animation {
 	const struct sprite *sprite;
 	unsigned int row;
 	unsigned int column;
@@ -35,22 +35,22 @@
 CORE_BEGIN_DECLS
 
 void
-animation_init(struct animation *, const struct sprite *, unsigned int);
+mlk_animation_init(struct mlk_animation *, const struct sprite *, unsigned int);
 
 void
-animation_start(struct animation *);
+mlk_animation_start(struct mlk_animation *);
 
 int
-animation_completed(const struct animation *);
+mlk_animation_completed(const struct mlk_animation *);
 
 int
-animation_update(struct animation *, unsigned int);
+mlk_animation_update(struct mlk_animation *, unsigned int);
 
 int
-animation_draw(const struct animation *, int, int);
+mlk_animation_draw(const struct mlk_animation *, int, int);
 
 void
-animation_drawable(struct animation *, struct drawable *, int, int);
+mlk_animation_drawable(struct mlk_animation *, struct drawable *, int, int);
 
 CORE_END_DECLS
 
--- a/libmlk-rpg/mlk/rpg/battle-entity-state-attacking.c	Sat Feb 18 12:43:05 2023 +0100
+++ b/libmlk-rpg/mlk/rpg/battle-entity-state-attacking.c	Sat Feb 18 13:06:04 2023 +0100
@@ -61,8 +61,8 @@
 	assert(atk);
 	assert(sprite_ok(which));
 
-	animation_init(&atk->anim, which, 100);
-	animation_start(&atk->anim);
+	mlk_animation_init(&atk->anim, which, 100);
+	mlk_animation_start(&atk->anim);
 }
 
 int
@@ -70,7 +70,7 @@
 {
 	assert(atk);
 
-	return animation_update(&atk->anim, ticks);
+	return mlk_animation_update(&atk->anim, ticks);
 }
 
 void
@@ -79,7 +79,7 @@
 	assert(atk);
 	assert(battle_entity_ok(et));
 
-	animation_draw(&atk->anim, et->x, et->y);
+	mlk_animation_draw(&atk->anim, et->x, et->y);
 }
 
 void
--- a/libmlk-rpg/mlk/rpg/battle-entity-state-attacking.h	Sat Feb 18 12:43:05 2023 +0100
+++ b/libmlk-rpg/mlk/rpg/battle-entity-state-attacking.h	Sat Feb 18 13:06:04 2023 +0100
@@ -25,7 +25,7 @@
 struct sprite;
 
 struct battle_entity_state_attacking {
-	struct animation anim;
+	struct mlk_animation anim;
 };
 
 void
--- a/libmlk-rpg/mlk/rpg/tileset-file.c	Sat Feb 18 12:43:05 2023 +0100
+++ b/libmlk-rpg/mlk/rpg/tileset-file.c	Sat Feb 18 13:06:04 2023 +0100
@@ -67,7 +67,7 @@
 struct tileset_animation_block {
 	struct texture texture;
 	struct sprite sprite;
-	struct animation animation;
+	struct mlk_animation animation;
 };
 
 struct context {
@@ -197,7 +197,7 @@
 			return -1;
 
 		sprite_init(&anim->sprite, &anim->texture, ctx->tilewidth, ctx->tileheight);
-		animation_init(&anim->animation, &anim->sprite, delay);
+		mlk_animation_init(&anim->animation, &anim->sprite, delay);
 	}
 
 	/*
--- a/libmlk-rpg/mlk/rpg/tileset.c	Sat Feb 18 12:43:05 2023 +0100
+++ b/libmlk-rpg/mlk/rpg/tileset.c	Sat Feb 18 13:06:04 2023 +0100
@@ -61,7 +61,7 @@
 		struct tileset_animation *ta = &ts->anims[i];
 
 		if (ta->animation)
-			animation_start(ta->animation);
+			mlk_animation_start(ta->animation);
 	}
 }
 
@@ -74,8 +74,8 @@
 		if (!ta->animation)
 			continue;
 
-		if (animation_update(ta->animation, ticks))
-			animation_start(ta->animation);
+		if (mlk_animation_update(ta->animation, ticks))
+			mlk_animation_start(ta->animation);
 	}
 }
 
@@ -87,7 +87,7 @@
 	const struct tileset_animation *ta;
 
 	if ((ta = find(ts, r, c)))
-		animation_draw(ta->animation, x, y);
+		mlk_animation_draw(ta->animation, x, y);
 	else
 		sprite_draw(ts->sprite, r, c, x, y);
 }
--- a/libmlk-rpg/mlk/rpg/tileset.h	Sat Feb 18 12:43:05 2023 +0100
+++ b/libmlk-rpg/mlk/rpg/tileset.h	Sat Feb 18 13:06:04 2023 +0100
@@ -35,7 +35,7 @@
 
 struct tileset_animation {
 	unsigned short id;
-	struct animation *animation;
+	struct mlk_animation *animation;
 };
 
 struct tileset {