home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / shareware / gms / doublebuffer.c < prev    next >
C/C++ Source or Header  |  1998-06-08  |  1KB  |  46 lines

  1. /*
  2. ** Name:      Double Buffer Demo
  3. ** Author:    Paul Manias
  4. ** Copyright: DreamWorld Productions © 1996-1997.
  5. ** SAS/C:     1> sc DoubleBuffer.c link startup=LIB:gms.o data=far
  6. ** Dice:      1> dcc -l0 -mD gms.o DoubleBuffer.c -o DoubleBuffer
  7. **
  8. ** This simple demo shows how to double buffer the screen.
  9. **
  10. */
  11.  
  12. #include <proto/games.h>
  13.  
  14. extern struct GMSBase *GMSBase;
  15. ULONG  PREFSNAME = DEFAULT;
  16.  
  17. void main(void)
  18. {
  19.   struct Picture *picture;
  20.   struct GameScreen *screen;
  21.  
  22.   if (picture = LoadPicFile("GMS:demos/data/PIC.Green",GETPALETTE|VIDEOMEM)) {
  23.  
  24.      if (screen = AddScreenTags(TAGS_GAMESCREEN,NULL,
  25.         GSA_MemPtr1,  picture->Data,
  26.         GSA_Planes,   picture->Planes,
  27.         GSA_ScrMode,  picture->ScrMode,
  28.         GSA_ScrType,  picture->ScrType,
  29.         GSA_ScrWidth, picture->Width,
  30.         GSA_ScrHeight,picture->Height,
  31.         GSA_Palette,  picture->Palette,
  32.         GSA_Attrib,   DBLBUFFER|CENTRE,
  33.         TAGEND)) {
  34.  
  35.         ShowScreen(screen);
  36.         while (!(ReadMouse(JPORT1)&MB_LMB)) {
  37.           WaitVBL();
  38.           SwapBuffers(screen);
  39.         }
  40.      FreePic(picture);
  41.      }
  42.   DeleteScreen(screen);
  43.   }
  44. }
  45.  
  46.