Zumindest kein Segfault mehr, die drehen sich aber lustig

main
Jonathan Hager 3 years ago
parent bc383b3827
commit 7de693fb25
Signed by: JonathanHager
GPG Key ID: 34881E488569708C

@ -8,9 +8,7 @@ AnimationHandler * AnimationHandlerInit(Animation **animations){
new->animations = animations;
new->currentAnimation = 0;
//new->currentFrame = new->animations[new->currentAnimation]->head;
new->currentFrame = animations[0]->head;
printf("Hier geht noch\n");
new->currentFrame = new->animations[new->currentAnimation]->head;
new->forward = 1;
}

@ -7,19 +7,20 @@
TextureAtlas * TextureAtlasInit(){
TextureAtlas *textures = (TextureAtlas *) malloc(sizeof(TextureAtlas));
LoadCursorTextures(textures->cursorTextures);
LoadCursorTextures(textures->cursorTextures, textures->cursorAnimation);
LoadWorkerTextures(textures->workerTextures);
LoadWorkerAnimations(textures->workerAnimations, textures->workerTextures);
return textures;
}
void LoadCursorTextures(Texture2D *cursorTextures){
void LoadCursorTextures(Texture2D *cursorTextures, Animation **cursorAnimation){
*cursorTextures = LoadTexture("assets/cursor.gif");
*(cursorTextures + 1) = LoadTexture("assets/cursor_down.gif");
Animation *new = AnimationInit();
AnimationInsertBack(new, cursorTextures);
cursorAnimation[0] = new;
}
void LoadWorkerTextures(Texture2D *workerTextures){
@ -57,7 +58,7 @@ void LoadWorkerTextures(Texture2D *workerTextures){
strcat(filename, number);
strcat(filename, ending);
printf("lol: %s ", filename);
//printf("file:%s:file\n", filename);
// Set correct values for next iteration
int lol = i % 8;
@ -122,7 +123,15 @@ void LoadWorkerAnimations(Animation **workerAnimations, Texture2D *workerTexture
for(i=0; i < 24; i++){
Animation *newAnimation = AnimationInit();
for(j = 0; j < 8; j++){
int obergrenze;
if(frame <= 79){
obergrenze = 5;
}
else{
obergrenze = 3;
}
for(j = 0; j < obergrenze; j++){
AnimationInsertBack(newAnimation, (workerTextures+frame));
frame++;
}

@ -7,7 +7,7 @@ typedef struct TextureAtlas TextureAtlas;
typedef struct TextureAtlas{
Texture2D cursorTextures[2];
Animation cursorAnimation;
Animation *cursorAnimation[1];
Texture2D workerTextures[104];
Animation *workerAnimations[24];
@ -17,7 +17,7 @@ typedef struct TextureAtlas{
// Initialize the full TextureAtlas struct with all Textures used in the game
TextureAtlas * TextureAtlasInit();
void LoadCursorTextures(Texture2D *cursorTextures);
void LoadCursorTextures(Texture2D *cursorTextures, Animation **cursorAnimation);
void LoadWorkerTextures(Texture2D *workerTextures);
void LoadWorkerAnimations(Animation **workerAnimations, Texture2D *workerTextures);

Binary file not shown.

Binary file not shown.

BIN
game.o

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
list.o

Binary file not shown.

BIN
main.o

Binary file not shown.

BIN
spiel

Binary file not shown.

@ -74,7 +74,7 @@ Sprite * SpriteCreate(TextureAtlas *atlas, int textureID, int x, int y){
animations = atlas->workerAnimations;
}
else if(textureID == cursor){
// Nix
animations = atlas->cursorAnimation;
}
else{
printf("\n\n\n\n\n\n\n\nSpriteCreate mit falscher ID aufgerufen oder ID nicht bekannt!!!\n\n\n\n\n\n\n\n");

Binary file not shown.

Binary file not shown.

BIN
tile.o

Binary file not shown.
Loading…
Cancel
Save