int main(void) { vga_init(); /* Create virtual screen. */ vbuf = malloc(VWIDTH * VHEIGHT); gl_setcontextvirtual(VWIDTH, VHEIGHT, 1, 8, vbuf); /* Set Mode X-style 320x240x256. */ vga_setmode(G320x240x256); gl_setrgbpalette(); vga_clear(); boxes(); demo1(); demo2(); vga_setmode(G320x200x256); /* Set linear 320x200x256. */ gl_setrgbpalette(); demo3(); vga_setmode(TEXT); exit(0); }
int main(int argc, char *argv[]) { vga_init(); if(argc>=2) { timescale=atoi(argv[1]); if(timescale<1)timescale=1; } VGAMODE = vga_getdefaultmode(); if (VGAMODE == -1) VGAMODE = G320x200x256; /* Default mode. */ if (!vga_hasmode(VGAMODE)) { printf("Mode not available.\n"); exit(-1); } VIRTUAL = 0; /* No virtual screen. */ if (vga_getmodeinfo(VGAMODE)->colors == 16 || (vga_getmodeinfo(VGAMODE)->flags & IS_MODEX)) /* These modes are supported indirectly by vgagl. */ VIRTUAL = 1; if (VIRTUAL) { /* Create virtual screen. */ gl_setcontextvgavirtual(VGAMODE); backscreen = gl_allocatecontext(); gl_getcontext(backscreen); } vga_setmode(VGAMODE); gl_setcontextvga(VGAMODE); /* Physical screen context. */ physicalscreen = gl_allocatecontext(); gl_getcontext(physicalscreen); if (COLORS == 256) gl_setrgbpalette(); if(argc==3)sleep(2); test(); /* Now do the same with clipping enabled. */ gl_clearscreen(0); gl_setclippingwindow(WIDTH / 4, HEIGHT / 4, WIDTH - WIDTH / 4 - 1, HEIGHT - HEIGHT / 4 - 1); test(); gl_disableclipping(); if (COLORS == 256) /* Show the logo if using 256 color mode. */ logotest(); getchar(); if (VIRTUAL) gl_freecontext(backscreen); vga_setmode(TEXT); exit(0); }
void graphicsinit(char *svgamode) //initialization of graphics, mode according to X_LOPIF { const short cur[32] = { 0x9FFF, 0x0FFF, 0x07FF, 0x83FF, 0xC1FF, 0xE0FF, 0xF067, 0xF003, 0xF001, 0xF000, 0xF800, 0xF800, 0xF800, 0xFC00, 0xFC00, 0xFC00, 0x0000, 0x6000, 0x7000, 0x3800, 0x1C00, 0x0E00, 0x0700, 0x0018, 0x07EC, 0x07EE, 0x001E, 0x03EE, 0x03EE, 0x001E, 0x00EC, 0x0002 }; xg_256=MM_Hic; //set Hicolor flag... initpalette(); x_settextjusty(0,2); // always write text from upper left corner #ifdef GGI // printf("Initializing GGI visual target.\n"); ggiVis = ggiOpen (NULL); ggiGetMode (ggiVis, &origMode); ggiSetSimpleMode (ggiVis, 800, 600, 1, GT_16BIT); SVGAx=799; SVGAy=599; ggiAddFlags(ggiVis,GGIFLAG_ASYNC); #else strupr(svgamode); // printf("Console switched to graphics mode.\n"); if(strstr(svgamode,".I")) { vga_setmode(G640x480x64K); gl_setcontextvga(G640x480x64K); SVGAx=639; SVGAy=479; } else if(strstr(svgamode,".K")) { vga_setmode(G1024x768x64K); gl_setcontextvga(G1024x768x64K); SVGAx=1023; SVGAy=767; } else if(strstr(svgamode,".L")) { vga_setmode(G1280x1024x64K); gl_setcontextvga(G1280x1024x64K); SVGAx=1279; SVGAy=1023; } if(strstr(svgamode,".M")) { vga_setmode(G1600x1200x64K); gl_setcontextvga(G1600x1200x64K); SVGAx=1599; SVGAy=1199; } { vga_setmode(G800x600x64K); gl_setcontextvga(G800x600x64K); SVGAx=799; SVGAy=599; } vga_runinbackground(1); vga_oktowrite(); gl_setwritemode(FONT_COMPRESSED|WRITEMODE_MASKED); gl_setfontcolors(0,vga_white()); //gl_setfont(8,8,gl_font8x8); gl_setrgbpalette(); gl_enableclipping(); #endif x_defcurs( (short *)cur, (short *)&cur[16], 15); //mouse kursor }