home *** CD-ROM | disk | FTP | other *** search
- /* Double Buffering
- ** ----------------
- ** This just shows how to double buffer the screen. You can also try out
- ** triple buffering just by changing the DBLBUFFER flag to TPLBUFFER in the
- ** ScreenStruct.
- **
- ** Notice that this thing does in fact fully multi-task (no forbid/permit)!
- ** Instead we set our task priority to be a little higher than any other
- ** tasks -- if we didn't do this sometimes our frames could be stalled (try
- ** removing the SetUserPri and watch the demo again).
- */
-
- MODULE 'games','games/games'
-
- PROC main()
- DEF screen:PTR TO gamescreen, loadpic:PTR TO picture
-
- loadpic := [
- PCV1,0, -> Version header.
- 0, -> Destination.
- 320,0,256, -> Width, Height.
- 5, -> Amount of Planes.
- 32, -> Amount of colours.
- 0, -> Palette.
- LORES OR COL12BIT, -> Screen mode.
- INTERLEAVED, -> Destination.
- 0, -> Parameters.
- 'GAMESLIB:data/IFF.Pic320'
- ]:picture;
-
- IF gmsbase := OpenLibrary('games.library',0)
- SetUserPrefs(0)
- IF (screen := AddScreen([TAGS,0,
- GSA_PALETTE,[$000,$130,$FCB,$FA9,$D88,$965,$644,$211,$400,$444,
- $FF0,$432,$CC0,$150,$501,$880,$261,$271,$382,$492,
- $5A3,$5B4,$677,$6C4,$788,$9AA,$BCC,$801,$901,$A02,
- $701,$601]:INT,
- GSA_SCRWIDTH,320,
- GSA_SCRHEIGHT,256,
- GSA_PLANES,5,
- GSA_SCRATTRIB,DBLBUFFER,
- GSA_SCRMODE,LORES OR COL12BIT,
- GSA_SCRTYPE,INTERLEAVED,
- TAGEND]))
-
- loadpic.data := screen.memptr1;
- IF (LoadPic(loadpic) = ERR_OK)
- ShowScreen(screen)
- REPEAT
- WaitSVBL()
- SwapBuffers(screen)
- UNTIL !(ReadMouse(JPORT1) AND MB_LMB)
- ENDIF
- DeleteScreen(screen)
- ENDIF
- CloseLibrary(gmsbase)
- ENDIF
- ENDPROC
-
-