Header file:
graphics.h
Synopsis:
void getmoderange (int gd, int *low, int *high);
gd - currently loaded graphic driver
low - lowest allowed graphic mode value
high - highest allowed graphic mode value
Description:
getmoderange() gets the range of valid video mode value for the given graphic driver.
getmoderange function in c graphics
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void) {
/* request auto detection */
int graphicDriver = DETECT, graphicMode;
int err, start, end;
char modeRange[256];
/* initialize graphics and local variables */
initgraph(&graphicDriver, &graphicMode, "C:/TURBOC3/BGI");
/* read result of initialization */
err = graphresult();
if (err != grOk) {
/* an error occurred */
printf("Graphic Error: %s\n",
grapherrormsg(err));
getch();
return 0;
}
/* get the mode range for this driver */
getmoderange(graphicDriver, &start, &end);
/* convert mode range info. into strings */
sprintf(modeRange, "Mode range for the graphic "
"driver %d is %d to %d", graphicDriver, start, end);
/* display the information */
settextjustify(CENTER_TEXT, CENTER_TEXT);
outtextxy(getmaxx() / 2 , getmaxy() / 2, modeRange);
/* clean up */
getch();
closegraph();
return 0;
}
Output: (getmoderange built-in function in c graphics.h)
No comments:
Post a Comment