Hello,
i've created a simple program which uses setviewport to set the viewport in which we specify the top left and bottom right corner and it considers top left corner as 0,0. The code for this is :-
Code:
#include <stdio.h>
#include <graphics.h>
#include <stdlib.h>
int main(void)
{
int gd=DETECT,gm,errorcode;
int xorigin,yorigin;
initgraph(&gd,&gm,"c:\\tc\\bgi");
errorcode=graphresult();
if(errorcode!=grOk)
{
printf("%s",grapherrormsg(errorcode));
exit(1);
}
xorigin=getmaxx()/2;
yorigin=getmaxy()/2;
line(xorigin,0,xorigin,getmaxy());
line(0,yorigin,getmaxx(),yorigin);
setviewport(xorigin,0,getmaxx(),yorigin,0);
line(0,0,100,100);
return 0;
}
Now my problem is that if i want to consider xorigin and yorigin as 0,0 and want to treat the screen as though i am drawing on graph paper i mean the co-ordinates increases as we go top right(X increases in right direction and Y increases in top direction). Then how shall i do it???
Best Regards,
Chotti.