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>_setactivepage() set memory area for writing images</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _setactivepage()        Set memory area for writing images

 #include   <graph.h>

 short far _setactivepage(page);
  short page;       Video memory page number

    _setactivepage() specifies the area in memory where graphics output
    is written. The display adapter must have a mode supporting multiple
    pages, and enough memory installed. The page argument establishes the
    current active page, where the default page is 0 (same as the visual
    page).

       Returns:     If successful, _setactivepage() returns the page
                    number of the previous active page. If unsuccessful,
                    it returns a negative value.

         Notes:     If you display one page while graphics routines write
                    to a different page, then use _setvisualpage() to
                    switch between them, screen updates will appear to be
                    instantaneous. This technique will permit screen
                    animation effects.

                    The MA adapter does not support multiple pages. The
                    CGA adapter supports multiple pages in text mode
                    only. The EGA, MCGA, and VGA adapters will support
                    multiple graphics pages if sufficient memory is
                    installed. You will need to test the amount of
                    available memory at runtime using the struct
                    videoconfig memory member, since if a routine writes
                    outside the range of the available buffer the image
                    will be lost.

                    Text which accompanies graphic images can also be
                    written to the active page while displaying a
                    different visual page if you use the text functions
                    _outtext(), _settextposition(), _gettextposition(),
                    _settextcolor(), _gettextcolor(), _settextwindow(),
                    and _wrapon() instead of the standard C I/O functions
                    (which do not recognize multiple pages).

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

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

    This program writes an image to an active page then displays the new
    page to simulate a moving ellipse

           #include <graph.h>

           main()
           {
              short i;
              short page = 1;
              _setvideomode( _MRES16COLOR );

              . . . test EGA or VGA video buffer for sufficient memory . . .

              for ( i = 0; i < 85; i += 5)
                 {
                 _setactivepage( page );
                 _ellipse( _GFILLINTERIOR, 40 + i, 10 + i, 200 + i, 110 + i
           );
                 page = _setvisualpage( page );
                 }

              _setvideomode( _DEFAULTMODE );
           }


See Also: _setvisualpage() _setvideomode() _settextposition()

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