home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Object Demo
- ** -----------
- ** Opens a screen according to the settings in an object file. See
- ** asm/UsingObjects/OBJScreen.s for the object definitions.
- */
-
- #include <proto/exec.h>
- #include <proto/games.h>
-
- struct GMSBase *GMSBase;
- extern struct ExecBase *SysBase;
-
- /*=========================================================================*/
-
- void main(void)
- {
- struct GameScreen *GameScreen;
- struct Picture *Picture;
- APTR OBJBase;
-
- if (GMSBase = (struct GMSBase *) OpenLibrary("games.library", 0)) {
- SetUserPrefs(0);
-
- if (OBJBase = LoadObjectFile("GAMESLIB:data/OBJ.Screen")) {
- if (GameScreen = GetObject(OBJBase,"DemoScreen")) {
- if (Picture = GetObject(OBJBase,"DemoPicture")) {
- if (LoadPic(Picture) == ERR_OK) {
- GameScreen->PicWidth = Picture->Width;
- GameScreen->PicHeight = Picture->Height;
- GameScreen->Planes = Picture->Planes;
- GameScreen->ScrMode = Picture->ScrMode;
- GameScreen->ScrType = Picture->ScrType;
- GameScreen->MemPtr1 = Picture->Data;
- GameScreen->Palette = Picture->Palette;
-
- if (AddScreen(GameScreen) == ERR_OK) {
- ShowScreen(GameScreen);
- WaitLMB();
- DeleteScreen(GameScreen);
- }
- FreePic(Picture);
- }
- }
- }
- FreeObjectFile(OBJBase);
- }
- CloseLibrary((struct Library *)GMSBase);
- }
- }
-
-