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

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

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

   /* 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;

   /* Draw the sprite rotated */
   PD_DrawSpriteRotated(sprite, DoubleBuffer, CURRENT, 1, 75);
   PD_ShowDoubleBuffer();
   PP_Wait(1000);
   PD_ClearSurface(DoubleBuffer, PD_CreateColor(DoubleBuffer, 0, 0, 0));
  
   /* Demonstrate X Shearing */
   PD_DrawSpriteXSheared(sprite, DoubleBuffer, CURRENT, 1, -50);
   PD_ShowDoubleBuffer();  
   PP_Wait(1000);
   PD_ClearSurface(DoubleBuffer, PD_CreateColor(DoubleBuffer, 0, 0, 0));
  

   /* Demonstrate Y Shearing */
   PD_DrawSpriteYSheared(sprite, DoubleBuffer, CURRENT, 1, 50);
   PD_ShowDoubleBuffer();
   PP_Wait(1000);
   PD_ClearSurface(DoubleBuffer, PD_CreateColor(DoubleBuffer, 0, 0, 0));

   /* Show Rotated Around */
   PD_DrawSpriteRotatedAround(sprite, DoubleBuffer, CURRENT, 1, 320, 240, 75);
   PD_ShowDoubleBuffer();
   PP_Wait(1000);
   PD_ClearSurface(DoubleBuffer, PD_CreateColor(DoubleBuffer, 0, 0, 0));

   PD_DestroySprite(sprite);

   PP_Wait(5000);

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

