#include "SDL.h"
#include "SDL_rwops_zzip.h"
#include <stdio.h>
#include <zzip.h>

int main(void) {
  SDL_Surface *screen;
  SDL_Surface *one;
  SDL_Surface *two;
  SDL_Rect rect;

  /* This is the RWops structure we'll be using */
  SDL_RWops *rw;

  SDL_Init(SDL_INIT_VIDEO);

  atexit(SDL_Quit);

  screen = SDL_SetVideoMode(640, 480, 16, SDL_DOUBLEBUF);

  /* SDL_RWFromZZIP will create an RWops for us, saving us the trouble
     of doing it ourselves like we had to in the last example.  It
     also does the same filename magic that zzip_open does. */
  rw = SDL_RWFromZZIP("penguins/penguin.bmp", "r");
  one = SDL_LoadBMP_RW(rw, 0);
  SDL_FreeRW(rw);

  /* We'll load two, just to point out how easy it is */
  rw = SDL_RWFromZZIP("penguins/penguin2.bmp", "r");
  two = SDL_LoadBMP_RW(rw, 0);
  SDL_FreeRW(rw);

  /* Haphazard way of getting stuff to the screen */
  rect.x = rect.y = 20;
  rect.w = one -> w;
  rect.y = one -> h;
  SDL_BlitSurface(one, NULL, screen, &rect);

  rect.x += rect.w + 10;
  rect.w = two -> w;
  rect.h = two -> h;
  SDL_BlitSurface(two, NULL, screen, &rect);

  SDL_Flip(screen);

  SDL_Delay(3000);
}
