diff --git a/dat.h b/dat.h index 4254bd2..6457e27 100644 --- a/dat.h +++ b/dat.h @@ -21,7 +21,6 @@ struct Image { struct State { SDL_Window *win; SDL_Renderer *ren; - Uint64 lastframe; Samply *sam; }; diff --git a/readme b/readme index 26f7cf5..09f31cc 100644 --- a/readme +++ b/readme @@ -8,12 +8,3 @@ i want people to be able to create their own pets without having to figure out how to recompile. run it with `SDL_LOGGING=app=debug ./slutpet` for verbose logging - -file layout: - -dat.h - data structure header -fns.h - functions and macros header - -slutpet.c - sdl init and close -img.c - loading images -samply.c - pet Samply diff --git a/samply.c b/samply.c index a82bd31..16ce3b1 100644 --- a/samply.c +++ b/samply.c @@ -13,9 +13,10 @@ put_samply_to_bed(Samply *sam) free_image(sam->walka); babble("free samply walk b!!"); free_image(sam->walkb); - babble("good night, samply!!"); - SDL_free(sam); } + + babble("good night, samply!!"); + SDL_free(sam); } Samply * @@ -33,7 +34,7 @@ wake_samply_up(SDL_Renderer *ren) babble("stand samply up!!"); sam->idle = load_image(ren, "samply/Samply.png"); if (!sam->idle) { - fuck("samply would rather stay in bed. too bad!"); + fuck("samply would rather stay in bed. too bad! %s", SDL_GetError()); put_samply_to_bed(sam); return NULL; } @@ -41,7 +42,7 @@ wake_samply_up(SDL_Renderer *ren) babble("samply walk! part 1!!"); sam->walka = load_image(ren, "samply/Samply_Walk1.png"); if (!sam->walka) { - fuck("samply would rather stay in bed. too bad!"); + fuck("samply would rather stay in bed. too bad! %s", SDL_GetError()); put_samply_to_bed(sam); return NULL; } @@ -49,7 +50,7 @@ wake_samply_up(SDL_Renderer *ren) babble("samply walk! part 2!!"); sam->walkb = load_image(ren, "samply/Samply_Walk2.png"); if (!sam->walkb) { - fuck("samply would rather stay in bed. too bad!"); + fuck("samply would rather stay in bed. too bad! %s", SDL_GetError()); put_samply_to_bed(sam); return NULL; } diff --git a/slutpet.c b/slutpet.c index 883cd73..69ae2b2 100644 --- a/slutpet.c +++ b/slutpet.c @@ -47,24 +47,15 @@ SDL_AppResult SDL_AppIterate(void *as) { State *st = as; - SDL_Texture *tx; - Uint64 ms; SDL_SetRenderDrawColor(st->ren, 0, 0, 0, SDL_ALPHA_TRANSPARENT); SDL_RenderClear(st->ren); - ms = SDL_GetTicks(); - if ((ms / 100) % 2) - tx = st->sam->walka->tex; - else - tx = st->sam->walkb->tex; - - if (SDL_RenderTexture(st->ren, tx, NULL, NULL) == false) { + if (SDL_RenderTexture(st->ren, st->sam->idle->tex, NULL, NULL) == false) { fuck("rendertexture fail: %s", SDL_GetError()); return SDL_APP_FAILURE; } SDL_RenderPresent(st->ren); - st->lastframe = SDL_GetTicks(); return SDL_APP_CONTINUE; } @@ -89,10 +80,8 @@ SDL_AppInit(void **as, int argc, char **argv) SDL_SetHint(SDL_HINT_X11_FORCE_OVERRIDE_REDIRECT, "1"); - st->lastframe = SDL_GetTicks(); - babble("create win+render..."); - if (!SDL_CreateWindowAndRenderer("slutpet", 320, 320, + if (!SDL_CreateWindowAndRenderer("slutpet", 320, 240, SDL_WINDOW_TRANSPARENT | SDL_WINDOW_BORDERLESS | SDL_WINDOW_NOT_FOCUSABLE | SDL_WINDOW_ALWAYS_ON_TOP, @@ -109,6 +98,5 @@ SDL_AppInit(void **as, int argc, char **argv) } babble("hi!!"); - babble("program startup took %llums!", SDL_GetTicks()); return SDL_APP_CONTINUE; }