sprite.c 509 B

12345678910111213141516171819202122
  1. #include <compression.h>
  2. #include "sprite.h"
  3. #include <debug.h>
  4. void Sprite_log(char* msg){
  5. dbg_sprintf(dbgout, "[Sprite] %s\n", msg);
  6. }
  7. void free_Sprite(Sprite* self){
  8. Sprite_log("Freeing sprite");
  9. free(self->data);
  10. free(self);
  11. }
  12. Sprite* new_Sprite(int width, int height, void* compressed_data){
  13. gfx_sprite_t* data = gfx_MallocSprite(width, height);
  14. Sprite* self = (Sprite*)malloc(sizeof(Sprite));
  15. zx7_Decompress(data, compressed_data);
  16. self->data = data;
  17. return self;
  18. }