Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_setwindow() define a window</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _setwindow()            Define a window

 #include   <graph.h>

 short _setwindow(finvert, wx1, wy1, wx2, wy2);
 short finvert;         Invert flag
 double wx1; wy1;       Upper left of window
 double wx2; wy2;       Lower ight of window

    _setwindow() defines a window in the current viewport with upper
    left corner (wx1, wy1) and lower right corner (wx2, wy2). If
    finvert is FALSE, the y axis increases from the top of the screen
    downwards; if finvert is TRUE, the y axis increases from the bottom
    of the screen upwards. After the window is set, it becomes the
    current window for all window functions (e.g. _setpixel_w() or
    _rectangle_w()).

    Returns:    Nonzero value for success; 0 otherwise.

   Portability:     MS-DOS only, true MDPA, CGA, EGA, MCGA, or VGA video
                    compatibles

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

        This program draws a rectangle using window coordinates.

    #include <conio.h>
    #include <graph.h>
    #include <stdlib.h>

    void main()
    {
        short nx, ny;
        struct videoconfig vstruc;

        _setvideomode(_MAXRESMODE);
        _getvideoconfig(&vstruc);

        nx = vstruc.numxpixels;
        ny = vstruc.numypixels;

        _setwindow(0, -2.0, -4.0, 2.0, 4.0);
        _rectangle_w(_GBORDER, -2.0, -4.0, 2.0, 4.0);

        getch();

        _setvideomode(_DEFAULTMODE);    /* Restore mode before leaving */
    }


See Also: _setviewport()

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