@ -0,0 +1,59 @@
|
|||||||
|
#include "animation.h"
|
||||||
|
#include "stdlib.h"
|
||||||
|
|
||||||
|
Animation * AnimationInit(){
|
||||||
|
Animation *animation = (Animation *) malloc(sizeof(Animation));
|
||||||
|
|
||||||
|
animation->head = 0;
|
||||||
|
animation->tail = 0;
|
||||||
|
|
||||||
|
return animation;
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimationFrame * AnimationFrameCreate(Texture2D *texture){
|
||||||
|
AnimationFrame *frame = (AnimationFrame *) malloc(sizeof(AnimationFrame));
|
||||||
|
|
||||||
|
frame->texture = texture;
|
||||||
|
frame->next = 0;
|
||||||
|
frame->prev = 0;
|
||||||
|
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimationInsertFront(Animation *animation, Texture2D *texture){
|
||||||
|
AnimationFrame *new = AnimationFrameCreate(texture);
|
||||||
|
|
||||||
|
if(list->head == 0){
|
||||||
|
list->head = new;
|
||||||
|
list->tail = new;
|
||||||
|
}
|
||||||
|
else if(list->head == list->tail){
|
||||||
|
list->head = new;
|
||||||
|
list->head->next = list->tail;
|
||||||
|
list->tail->prev = list->head;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
list->head->prev = new;
|
||||||
|
new->next = list->head;
|
||||||
|
list->head = new;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimationInsertBack(Animation *animation, Texture2D *texture){
|
||||||
|
AnimationFrame *new = AnimationFrameCreate(texture);
|
||||||
|
|
||||||
|
if(list->head == 0){
|
||||||
|
list->head = new;
|
||||||
|
list->tail = new;
|
||||||
|
}
|
||||||
|
else if(list->head == list->tail){
|
||||||
|
list->tail = new;
|
||||||
|
list->head->next = list->tail;
|
||||||
|
list->tail->prev = list->head;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
list->tail->next = new;
|
||||||
|
new->prev = list->tail;
|
||||||
|
list->tail = new;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef ANIMATION_H_
|
||||||
|
#define ANIMATION_H_
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
struct Animation;
|
||||||
|
struct AnimationFrame;
|
||||||
|
|
||||||
|
typedef struct Animation {
|
||||||
|
AnimationFrame *head;
|
||||||
|
AnimationFrame *tail;
|
||||||
|
} Animation;
|
||||||
|
|
||||||
|
typedef struct AnimationFrame {
|
||||||
|
Texture2D *texture;
|
||||||
|
|
||||||
|
AnimationFrame *next;
|
||||||
|
AnimationFrame *prev;
|
||||||
|
} AnimationFrame;
|
||||||
|
|
||||||
|
Animation * AnimationInit();
|
||||||
|
|
||||||
|
AnimationFrame * AnimationFrameCreate(Texture2D *texture);
|
||||||
|
|
||||||
|
void AnimationInsertFront(Animation *animation, Texture2D *texture);
|
||||||
|
void AnimationInsertBack(Animation *animation, Texture2D *texture);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Before Width: | Height: | Size: 732 B After Width: | Height: | Size: 704 B |
|
Before Width: | Height: | Size: 732 B After Width: | Height: | Size: 704 B |
|
Before Width: | Height: | Size: 842 B After Width: | Height: | Size: 814 B |
|
Before Width: | Height: | Size: 842 B After Width: | Height: | Size: 814 B |
|
Before Width: | Height: | Size: 842 B After Width: | Height: | Size: 814 B |
|
After Width: | Height: | Size: 820 B |
|
After Width: | Height: | Size: 820 B |
|
Before Width: | Height: | Size: 732 B After Width: | Height: | Size: 704 B |
|
After Width: | Height: | Size: 757 B |
|
After Width: | Height: | Size: 757 B |
|
After Width: | Height: | Size: 676 B |
|
After Width: | Height: | Size: 676 B |
|
After Width: | Height: | Size: 676 B |
|
After Width: | Height: | Size: 771 B |
|
After Width: | Height: | Size: 771 B |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 760 B |
|
After Width: | Height: | Size: 753 B |
|
Before Width: | Height: | Size: 799 B After Width: | Height: | Size: 771 B |
|
After Width: | Height: | Size: 775 B |
|
After Width: | Height: | Size: 728 B |
|
After Width: | Height: | Size: 771 B |
|
After Width: | Height: | Size: 817 B |
|
Before Width: | Height: | Size: 782 B After Width: | Height: | Size: 754 B |
|
After Width: | Height: | Size: 790 B |
|
Before Width: | Height: | Size: 782 B After Width: | Height: | Size: 754 B |
|
Before Width: | Height: | Size: 783 B After Width: | Height: | Size: 755 B |
|
After Width: | Height: | Size: 809 B |
|
After Width: | Height: | Size: 733 B |
|
After Width: | Height: | Size: 749 B |
|
After Width: | Height: | Size: 765 B |
|
After Width: | Height: | Size: 756 B |
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 738 B |
|
After Width: | Height: | Size: 767 B |
|
After Width: | Height: | Size: 758 B |
|
After Width: | Height: | Size: 816 B |
|
After Width: | Height: | Size: 772 B |
|
After Width: | Height: | Size: 736 B |
|
After Width: | Height: | Size: 700 B |
|
After Width: | Height: | Size: 777 B |
|
Before Width: | Height: | Size: 840 B After Width: | Height: | Size: 812 B |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 692 B |
|
Before Width: | Height: | Size: 728 B After Width: | Height: | Size: 700 B |
|
Before Width: | Height: | Size: 724 B After Width: | Height: | Size: 696 B |
|
Before Width: | Height: | Size: 716 B After Width: | Height: | Size: 688 B |
|
After Width: | Height: | Size: 675 B |
|
After Width: | Height: | Size: 712 B |
|
After Width: | Height: | Size: 764 B |
|
After Width: | Height: | Size: 689 B |
|
After Width: | Height: | Size: 670 B |
|
After Width: | Height: | Size: 695 B |
|
After Width: | Height: | Size: 713 B |
|
After Width: | Height: | Size: 756 B |
|
After Width: | Height: | Size: 664 B |
|
After Width: | Height: | Size: 688 B |
|
After Width: | Height: | Size: 679 B |
|
After Width: | Height: | Size: 682 B |
|
After Width: | Height: | Size: 715 B |
|
Before Width: | Height: | Size: 798 B After Width: | Height: | Size: 770 B |
|
After Width: | Height: | Size: 721 B |
|
After Width: | Height: | Size: 761 B |
|
Before Width: | Height: | Size: 720 B After Width: | Height: | Size: 692 B |
|
Before Width: | Height: | Size: 719 B After Width: | Height: | Size: 691 B |
|
Before Width: | Height: | Size: 726 B After Width: | Height: | Size: 698 B |
|
After Width: | Height: | Size: 701 B |
|
After Width: | Height: | Size: 753 B |
|
After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 720 B |
|
Before Width: | Height: | Size: 703 B |
|
Before Width: | Height: | Size: 740 B |
|
Before Width: | Height: | Size: 792 B |
|
Before Width: | Height: | Size: 717 B |
|
Before Width: | Height: | Size: 698 B |
|
Before Width: | Height: | Size: 723 B |
|
Before Width: | Height: | Size: 741 B |
|
Before Width: | Height: | Size: 784 B |
|
Before Width: | Height: | Size: 692 B |
|
Before Width: | Height: | Size: 716 B |
|
Before Width: | Height: | Size: 707 B |
|
Before Width: | Height: | Size: 710 B |
|
Before Width: | Height: | Size: 743 B |
|
Before Width: | Height: | Size: 788 B |
|
Before Width: | Height: | Size: 781 B |
|
Before Width: | Height: | Size: 761 B |
|
Before Width: | Height: | Size: 786 B |
|
Before Width: | Height: | Size: 844 B |
|
Before Width: | Height: | Size: 749 B |
|
Before Width: | Height: | Size: 800 B |
|
Before Width: | Height: | Size: 764 B |
|
Before Width: | Height: | Size: 728 B |
|
Before Width: | Height: | Size: 805 B |
|
Before Width: | Height: | Size: 803 B |
|
Before Width: | Height: | Size: 756 B |
|
Before Width: | Height: | Size: 799 B |