home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / misc / gms_dev.lha / GMS / Source / C / OBJScreen.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-16  |  1.3 KB  |  52 lines

  1. /*
  2. ** Object Demo
  3. ** -----------
  4. ** Opens a screen according to the settings in an object file.  See
  5. ** asm/UsingObjects/OBJScreen.s for the object definitions.
  6. */
  7.  
  8. #include <proto/exec.h>
  9. #include <proto/games.h>
  10.  
  11. struct GMSBase *GMSBase;
  12. extern struct ExecBase *SysBase;
  13.  
  14. /*=========================================================================*/
  15.  
  16. void main(void)
  17. {
  18.   struct GameScreen *GameScreen;
  19.   struct Picture *Picture;
  20.   APTR OBJBase;
  21.  
  22.   if (GMSBase = (struct GMSBase *) OpenLibrary("games.library", 0)) {
  23.    SetUserPrefs(0);
  24.  
  25.    if (OBJBase = LoadObjectFile("GAMESLIB:data/OBJ.Screen")) {
  26.     if (GameScreen = GetObject(OBJBase,"DemoScreen")) {
  27.      if (Picture = GetObject(OBJBase,"DemoPicture")) {
  28.       if (LoadPic(Picture) == ERR_OK) {
  29.          GameScreen->PicWidth = Picture->Width;
  30.          GameScreen->PicHeight = Picture->Height;
  31.          GameScreen->Planes = Picture->Planes;
  32.          GameScreen->ScrMode = Picture->ScrMode;
  33.          GameScreen->ScrType = Picture->ScrType;
  34.          GameScreen->MemPtr1 = Picture->Data;
  35.          GameScreen->Palette = Picture->Palette;
  36.  
  37.          if (AddScreen(GameScreen) == ERR_OK) {
  38.             ShowScreen(GameScreen);
  39.             WaitLMB();
  40.             DeleteScreen(GameScreen);
  41.          }
  42.        FreePic(Picture);
  43.       }
  44.      }
  45.     }
  46.    FreeObjectFile(OBJBase);
  47.    }
  48.   CloseLibrary((struct Library *)GMSBase);
  49.   }
  50. }
  51.  
  52.