diff libcore/core/animation.h @ 183:604fad63bd9c

core: fix animation delay
author David Demelier <markand@malikania.fr>
date Mon, 02 Nov 2020 13:42:51 +0100
parents eb0a7ab71023
children
line wrap: on
line diff
--- a/libcore/core/animation.h	Tue Oct 27 16:54:18 2020 +0100
+++ b/libcore/core/animation.h	Mon Nov 02 13:42:51 2020 +0100
@@ -66,6 +66,16 @@
 animation_start(struct animation *an);
 
 /**
+ * Tells if the animation has completed.
+ *
+ * \pre an != NULL
+ * \param an the animation
+ * \return True if the animation shown all images.
+ */
+bool
+animation_completed(const struct animation *an);
+
+/**
  * Update the animation.
  *
  * You must call this function at each loop iteration to update the animation
@@ -82,14 +92,14 @@
 /**
  * Draw the animation.
  *
- * \pre an != NULL
+ * \pre an != NULL && !animation_completed(an)
  * \param an the animation
  * \param x the X coordinate
  * \param y the Y coordinate
  * \return False in case of rendering error.
  */
 bool
-animation_draw(struct animation *an, int x, int y);
+animation_draw(const struct animation *an, int x, int y);
 
 /**
  * Create a drawable from an animation.