parent
92beda7778
commit
bc383b3827
@ -0,0 +1,33 @@
|
|||||||
|
#include "animationHandler.h"
|
||||||
|
#include "animation.h"
|
||||||
|
#include "stdlib.h"
|
||||||
|
#include "stdio.h"
|
||||||
|
|
||||||
|
AnimationHandler * AnimationHandlerInit(Animation **animations){
|
||||||
|
AnimationHandler *new = (AnimationHandler *) malloc(sizeof(AnimationHandler));
|
||||||
|
|
||||||
|
new->animations = animations;
|
||||||
|
new->currentAnimation = 0;
|
||||||
|
//new->currentFrame = new->animations[new->currentAnimation]->head;
|
||||||
|
new->currentFrame = animations[0]->head;
|
||||||
|
printf("Hier geht noch\n");
|
||||||
|
new->forward = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimationUpdate(AnimationHandler *animationHandler){
|
||||||
|
if(animationHandler->forward == 1){
|
||||||
|
animationHandler->currentFrame = animationHandler->currentFrame->next;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
animationHandler->currentFrame = animationHandler->currentFrame->prev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimationReset(AnimationHandler *animationHandler){
|
||||||
|
animationHandler->currentFrame = animationHandler->animations[animationHandler->currentAnimation]->head;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AnimationChangeAnimation(AnimationHandler *animationHandler, int newAnimation){
|
||||||
|
animationHandler->currentAnimation = newAnimation;
|
||||||
|
AnimationReset(animationHandler);
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef ANIMATIONHANDLER_H_
|
||||||
|
#define ANIMATIONHANDLER_H_
|
||||||
|
#include "raylib.h"
|
||||||
|
#include "animation.h"
|
||||||
|
#include "stdio.h"
|
||||||
|
|
||||||
|
typedef struct AnimationHandler AnimationHandler;
|
||||||
|
|
||||||
|
typedef struct AnimationHandler{
|
||||||
|
Animation **animations;
|
||||||
|
AnimationFrame *currentFrame;
|
||||||
|
int currentAnimation;
|
||||||
|
int forward;
|
||||||
|
} AnimationHandler;
|
||||||
|
|
||||||
|
AnimationHandler * AnimationHandlerInit(Animation **animations);
|
||||||
|
void AnimationUpdate(AnimationHandler *animationHandler);
|
||||||
|
void AnimationReset(AnimationHandler *animationHandler);
|
||||||
|
void AnimationChangeAnimation(AnimationHandler *animationHandler, int newAnimation);
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
#ifndef TEXTUREIDS_H_
|
||||||
|
#define TEXTUREIDS_H_
|
||||||
|
|
||||||
|
#define cursor 0
|
||||||
|
#define worker 1
|
||||||
|
|
||||||
|
#endif
|
||||||
Binary file not shown.
@ -1,14 +0,0 @@
|
|||||||
#ifndef ANIMATIONHANDLER_H_
|
|
||||||
#define ANIMATIONHANDLER_H_
|
|
||||||
#include "raylib.h"
|
|
||||||
|
|
||||||
|
|
||||||
struct AnimationHandler;
|
|
||||||
|
|
||||||
typedef struct AnimationHandler{
|
|
||||||
Texture2D *textures;
|
|
||||||
|
|
||||||
|
|
||||||
} AnimationHandler;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue