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>_getcurrentposition() get current graphic output position</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _getcurrentposition()   Get current graphic output position

 #include   <graph.h>

 struct xycoord far _getcurrentposition( void );

    _getcurrentposition() gets the logical coordinates of the current
    image output position. The next image output will occur at that
    point.

       Returns:     _getcurrentposition() returns the logical coordinates
                    of the position (x,y) in an xycoord structure,
                    defined in graph.h:

                    struct xycoord {
                       short xcoord;    x coordinate (horizontal)
                       short ycoord;    y coordinate (vertical)
                       };

         Notes:     The graphics functions recognize two sets of
                    coordinates:

                    1. Physical coordinates determined by the hardware
                    and display configuration of the user's environment.

                    2. Logical coordinates defined by the application,
                    which can be reassigned to different physical
                    coordinates.

                    The current logical position can be changed using
                    _arc() and _moveto(). The dimensions of the x and y
                    axes depend on the available display hardware and the
                    selected video mode. These values are accessible at
                    run time by examining the numxpixels and numypixels
                    members of the videoconfig structure returned by
                    _getvideoconfig().

                    The physical coordinates of any logical point can be
                    determined using _getphyscoord(), and the logical
                    coordinates of any physical point can be determined
                    with _getviewcoord().

                    The logical and physical coordinate systems affect
                    the location of images only, and have no effect on
                    the location of text.

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

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

    This program gets the current image output position and successively
    displaces it to draw a diagonal dashed bar.

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

           main()
           {
              struct xycoord xy;
              int i;

              _setvideomode( _MRES4COLOR );
              xy = _getviewcoord( 0, 0 );
              _moveto ( xy.xcoord, xy.ycoord );

              for ( i = 0; i < 36; i++ )
                 {
                 xy = _getcurrentposition( );
                 _moveto( xy.xcoord + 20, xy.ycoord + 16 );
                 _lineto( xy.xcoord + 8,  xy.ycoord + 4);
                 }

              while ( !kbhit() );
              _setvideomode( _DEFAULTMODE );
           }


See Also: _moveto() _lineto() _gettextposition()

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