libanim

changeset 59:dae22390c34c

added anm_set_animation_name
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 27 Dec 2013 10:58:23 +0200
parents fe017bde08bc
children 8f7193d00555
files example/test.c src/anim.c src/anim.h
diffstat 3 files changed, 13 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/example/test.c	Fri Dec 27 06:28:43 2013 +0200
     1.2 +++ b/example/test.c	Fri Dec 27 10:58:23 2013 +0200
     1.3 @@ -252,7 +252,7 @@
     1.4  	glRotatef(cam_theta, 0, 1, 0);
     1.5  
     1.6  	if(cur_anim != next_anim) {
     1.7 -		float t = (msec - trans_start_tm) / 1000.0;
     1.8 +		float t = (msec - trans_start_tm) / 1500.0;
     1.9  
    1.10  		if(t >= 1.0) {
    1.11  			t = 1.0;
     2.1 --- a/src/anim.c	Fri Dec 27 06:28:43 2013 +0200
     2.2 +++ b/src/anim.c	Fri Dec 27 10:58:23 2013 +0200
     2.3 @@ -39,6 +39,15 @@
     2.4  	free(anim->name);
     2.5  }
     2.6  
     2.7 +void anm_set_animation_name(struct anm_animation *anim, const char *name)
     2.8 +{
     2.9 +	char *newname = malloc(strlen(name) + 1);
    2.10 +	if(!newname) return;
    2.11 +
    2.12 +	free(anim->name);
    2.13 +	anim->name = newname;
    2.14 +}
    2.15 +
    2.16  /* ---- node implementation ----- */
    2.17  
    2.18  int anm_init_node(struct anm_node *node)
     3.1 --- a/src/anim.h	Fri Dec 27 06:28:43 2013 +0200
     3.2 +++ b/src/anim.h	Fri Dec 27 10:58:23 2013 +0200
     3.3 @@ -65,6 +65,9 @@
     3.4  int anm_init_animation(struct anm_animation *anim);
     3.5  void anm_destroy_animation(struct anm_animation *anim);
     3.6  
     3.7 +void anm_set_animation_name(struct anm_animation *anim, const char *name);
     3.8 +
     3.9 +
    3.10  /* node constructor and destructor */
    3.11  int anm_init_node(struct anm_node *node);
    3.12  void anm_destroy_node(struct anm_node *node);