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>_getwindowcoord() translate view to window coordinates</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _getwindowcoord()       Translate view to window coordinates

 #include   <graph.h>

 struct _wxycoord _getwindowcoord(x, y);
 short x, short y;              Physical coordinates to be translated

    _getwindowcoord() translates physical screen coordinates (x, y)
    into an _wxycoord structure, translating them into window pair
    coordinates. Also see _getviewcoord().

    Returns:         The coordinates in a _wxycoord structure.

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

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

    This program moves to (20, 20), translates to window coordinates, adds 10
    to the x coordinate, translates back to view coordinates, draws a 10 pixel
    long line to connect the two points.

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

    enum BOOL {FALSE, TRUE};

    void main()
    {
        struct xycoord view;
        struct _wxycoord thiswin;

        _setvideomode(_MAXRESMODE);
        _setwindow(FALSE, -125.0, -100.0, 125.0, 100.0);

        _moveto(20, 20);
        thiswin = _getwindowcoord(20, 20);    /* View to window coords */
        thiswin.wx += 10;
        view = _getviewcoord_wxy(&thiswin); /* Translate window to view */
        _lineto(view.xcoord, view.ycoord);
    }

See Also: _getphyscoord() _getwindowcoord() _getviewcoord()

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