Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>getmaxx() get the current x resolution</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 getmaxx()               Get the Current x Resolution

 #include   <graphics.h>

 int far    getmaxx(void);

    getmaxx() returns the maximum x screen coordinate for the current
    graphics mode. This function is very useful for positioning text and
    graphics on the screen.

    Returns:    The maximum x screen coordinate.

   -------------------------------- Example ---------------------------------

    The following statements center the string on the screen and print
    it.

           #include <graphics.h>
           #include <conio.h>

           int gdriver = DETECT;
           int gmode;

           main()
           {
               int maxx, maxy;
               int xcenter, ycenter, adjx;
               int len;
               char *tst = "This string is centered.";

               initgraph(&gdriver,&gmode,"");
               maxx = getmaxx();
               maxy = getmaxy();
               xcenter = maxx/2;
               ycenter = maxy/2;
               len = strlen(tst)*8;
               adjx = xcenter - len/2;
               outtextxy(adjx,ycenter,tst);
               getch();
               closegraph();
           }

See Also: getmaxy()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson