#ifdef __WIN32__
#include <windows.h>
#endif

#include "PowerPak/powerpak.h"
#include "PowerPak/powerdraw.h"

main(int argc, char *argv[])
{
   PD_Sprite *sprite;
   int i;

   /* Initialize the library */
   PP_Init();
   PD_Init();

   /* Initialize 640x480x16bpp graphics mode */
   PD_SetGFXMode(640, 480, 16, PD_DEFAULT);

   /* Initialize the sprite 256x256 pixels 2 frames */
   sprite = PD_SpriteInit(2, 166, 102);

   /* Get the frames for the sprite */
   PD_GetSpriteFrame (sprite, "ex5-1.pcx", 0);
   PD_GetSpriteFrame (sprite, "ex5-2.pcx", 1);

   sprite->x = 237;
   sprite->y = 189;

  PD_ClearSurface(DoubleBuffer, PD_CreateColor(Screen, 0xFF, 0xFF, 0xFF));

   /* Draw the sprite */
   for (i = 0; i < 50; i++){
      PD_DrawSprite(sprite, DoubleBuffer, CURRENT, 1);
      PD_ShowDoubleBuffer();
   }
   /* Draw the vertical flipped sprite */
   for (i = 0; i < 50; i++){
      PD_DrawSpriteVFlipped(sprite, DoubleBuffer, CURRENT, 1);
      PD_ShowDoubleBuffer();
   }
   /* Draw the vertical and horizontal flipped sprite */
   for (i = 0; i < 50; i++){
      PD_DrawSpriteVHFlipped(sprite, DoubleBuffer, CURRENT, 1);
      PD_ShowDoubleBuffer();
   }
   /* Draw the horizontal flipped sprite */
   for (i = 0; i < 50; i++){
      PD_DrawSpriteHFlipped(sprite, DoubleBuffer, CURRENT, 1);
      PD_ShowDoubleBuffer();
   }

   PD_DestroySprite(sprite);

   PP_Wait(5000);

   /* Cleanup */
   PD_Quit();
   PP_Quit();
}

