home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C++ Games Programming
/
CPPGAMES.ISO
/
fgl
/
fglight
/
exc.arj
/
TEMP
/
08-10.C
< prev
next >
Wrap
Text File
|
1995-01-20
|
1KB
|
59 lines
#include <fastgraf.h>
#include <stdio.h>
#include <stdlib.h>
void main(void);
void main()
{
int new_mode, old_mode;
int page, status;
fg_initpm();
new_mode = fg_bestmode(320,200,1);
if (new_mode < 0 || new_mode == 12)
{
printf("This program requires a 320 ");
printf("x 200 color graphics mode.\n");
exit(1);
}
old_mode = fg_getmode();
fg_setmode(new_mode);
page = fg_findpage();
status = fg_initxms();
if (status == 0) status = fg_allocxms(page);
if (status < 0)
{
status = fg_initems();
if (status == 0) status = fg_allocems(page);
}
if (status < 0) status = fg_alloccms(page);
if (status < 0)
{
fg_setmode(old_mode);
fg_reset();
printf("Unable to create logical page.\n");
exit(1);
}
fg_setcolor(7);
fg_rect(0,319,0,199);
fg_setcolor(9);
fg_locate(12,18);
fg_text("test",4);
fg_waitkey();
fg_copypage(0,page);
fg_erase();
fg_waitkey();
fg_copypage(page,0);
fg_waitkey();
fg_freepage(page);
fg_setmode(old_mode);
fg_reset();
}