static void PrintInfo(void) { char aux[81]; int x, y; sprintf(aux, " Mode: %dx%d %d bpp ", GrCurrentVideoMode()->width, GrCurrentVideoMode()->height, GrCurrentVideoMode()->bpp); x = (GrMaxX() - GrFontStringWidth(&GrDefaultFont, aux, strlen(aux), GR_BYTE_TEXT)) / 2; y = (GrMaxY() - GrFontStringHeight(&GrDefaultFont, aux, strlen(aux), GR_BYTE_TEXT)) / 2; GrTextXY(x, y, aux, GrWhite(), GrBlack()); }
/* ** Open graphics */ static PSD DJGR_open(PSD psd) { int x; int y; int c; GrVideoMode *md_info; x = 640; y = 480; c = 256; GrSetMode(GR_width_height_color_graphics,x,y,c); md_info = (GrVideoMode *) GrCurrentVideoMode(); psd->xres = psd->xvirtres = GrScreenX(); psd->yres = psd->yvirtres = GrScreenY(); psd->linelen = md_info->lineoffset; psd->planes = 1; psd->bpp = md_info->bpp; psd->ncolors = GrNumColors(); psd->flags = PSF_SCREEN; psd->addr = 0; /* FIXME */ /* note: must change psd->pixtype here for truecolor systems*/ psd->pixtype = MWPF_PALETTE; return psd; }
static void the_info(int x, int y) { char aux[81]; char sys[4] = "?"; int nsys; char *kbsysencoding; int nenc; grt_centered.txo_fgcolor.v = CYAN; grt_centered.txo_font = grf_std; nsys = GrGetLibrarySystem(); if (nsys == MGRX_VERSION_GCC_386_DJGPP) strcpy(sys, "DJ2"); else if (nsys == MGRX_VERSION_GCC_386_LINUX) strcpy(sys, "LNX"); else if (nsys == MGRX_VERSION_GCC_386_X11) strcpy(sys, "X11"); else if (nsys == MGRX_VERSION_GCC_X86_64_LINUX) strcpy(sys, "L64"); else if (nsys == MGRX_VERSION_GCC_X86_64_X11) strcpy(sys, "X64"); else if (nsys == MGRX_VERSION_GCC_386_WIN32) strcpy(sys, "W32"); nenc = GrGetKbSysEncoding(); kbsysencoding = GrStrEncoding(nenc); sprintf(aux, "Version:%x System:%s", GrGetLibraryVersion(), sys); GrDrawString(aux, strlen(aux), 0 + x, 0 + y, &grt_centered); sprintf(aux, "KbSysEncoding:%s", kbsysencoding); GrDrawString(aux, strlen(aux), 0 + x, 20 + y, &grt_centered); sprintf(aux, "VideoDriver: %s", GrCurrentVideoDriver()->name); GrDrawString(aux, strlen(aux), 0 + x, 40 + y, &grt_centered); sprintf(aux, "Mode: %dx%d %d bpp", GrCurrentVideoMode()->width, GrCurrentVideoMode()->height, GrCurrentVideoMode()->bpp); GrDrawString(aux, strlen(aux), 0 + x, 60 + y, &grt_centered); }
/* ** Open graphics */ static PSD DJGR_open(PSD psd) { PSUBDRIVER subdriver; GrVideoMode *md_info; int vwidth,vheight,vbpp; vwidth = SCREEN_WIDTH; vheight = SCREEN_HEIGHT; if(SCREEN_PIXTYPE == MWPF_TRUECOLOR8888) { vbpp=32; } else if(SCREEN_PIXTYPE == MWPF_TRUECOLOR888) { vbpp=24; } else if(SCREEN_PIXTYPE == MWPF_TRUECOLOR565) { vbpp=16; } else { vbpp=8; //palette } GrSetMode(GR_width_height_bpp_graphics,vwidth,vheight,vbpp); md_info = (GrVideoMode *) GrCurrentVideoMode(); psd->xres = psd->xvirtres = GrScreenX(); psd->yres = psd->yvirtres = GrScreenY(); psd->planes = 1; psd->bpp = md_info->bpp; psd->ncolors = psd->bpp >= 24 ? (1 << 24) : (1 << psd->bpp); psd->flags = PSF_SCREEN | PSF_ADDRMALLOC; /* Calculate the correct size and linelen here */ GdCalcMemGCAlloc(psd, psd->xres, psd->yres, psd->planes, psd->bpp, &psd->size, &psd->pitch); if(psd->bpp == 32) { psd->pixtype = MWPF_TRUECOLOR8888; } else if(psd->bpp == 16) { psd->pixtype = MWPF_TRUECOLOR565; } else if(psd->bpp == 24) { psd->pixtype = MWPF_TRUECOLOR888; } else { psd->pixtype = MWPF_PALETTE; } psd->portrait = MWPORTRAIT_NONE; psd->data_format = set_data_format(psd); /* * set and initialize subdriver into screen driver * psd->size is calculated by subdriver init */ subdriver = select_fb_subdriver(psd); psd->orgsubdriver = subdriver; set_subdriver(psd, subdriver); if ((psd->addr = malloc(psd->size)) == NULL) return NULL; return psd; }