Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <graph.h>
    short _FAR _setvideomode( short mode );

Description:
    The _setvideomode function sets the video mode according to the value of
    the mode argument.  The value of mode can be one of the following:


         Mode           Type    Size    Colors    Adapter

         _MAXRESMODE   (graphics mode with highest resolution)
         _MAXCOLORMODE (graphics mode with most colors)
         _DEFAULTMODE  (restores screen to original mode)
         _TEXTBW40      M,T    40 x 25    16   MDPA,HGC,VGA,SVGA
         _TEXTC40       C,T    40 x 25    16   CGA,EGA,MCGA,VGA,SVGA
         _TEXTBW80      M,T    80 x 25    16   MDPA,HGC,VGA,SVGA
         _TEXTC80       C,T    80 x 25    16   CGA,EGA,MCGA,VGA,SVGA
         _MRES4COLOR    C,G   320 x 200    4   CGA,EGA,MCGA,VGA,SVGA
         _MRESNOCOLOR   C,G   320 x 200    4   CGA,EGA,MCGA,VGA,SVGA
         _HRESBW        C,G   640 x 200    2   CGA,EGA,MCGA,VGA,SVGA
         _TEXTMONO      M,T    80 x 25    16   MDPA,HGC,VGA,SVGA
         _HERCMONO      M,G   720 x 350    2   HGC
         _MRES16COLOR   C,G   320 x 200   16   EGA,VGA,SVGA
         _HRES16COLOR   C,G   640 x 200   16   EGA,VGA,SVGA
         _ERESNOCOLOR   M,G   640 x 350    4   EGA,VGA,SVGA
         _ERESCOLOR     C,G   640 x 350  4/16  EGA,VGA,SVGA
         _VRES2COLOR    C,G   640 x 480    2   MCGA,VGA,SVGA
         _VRES16COLOR   C,G   640 x 480   16   VGA,SVGA
         _MRES256COLOR  C,G   320 x 200  256   MCGA,VGA,SVGA
         _URES256COLOR  C,G   640 x 400  256   SVGA
         _VRES256COLOR  C,G   640 x 480  256   SVGA
         _SVRES16COLOR  C,G   800 x 600   16   SVGA
         _SVRES256COLOR C,G   800 x 600  256   SVGA
         _XRES16COLOR   C,G  1024 x 768   16   SVGA
         _XRES256COLOR  C,G  1024 x 768  256   SVGA

    In the preceding table, the Type column contains the following letters:

    M
        indicates monochrome; multiple colors are shades of grey

    C
        indicates color

    G
        indicates graphics mode; size is in pixels

    T
        indicates text mode; size is in columns and rows of characters

    The Adapter column contains the following codes:

    MDPA
        IBM Monochrome Display/Printer Adapter

    CGA
        IBM Color Graphics Adapter

    EGA
        IBM Enhanced Graphics Adapter

    VGA
        IBM Video Graphics Array

    MCGA
        IBM Multi-Color Graphics Array

    HGC
        Hercules Graphics Adapter

    SVGA
        SuperVGA adapters

    The modes _MAXRESMODE and _MAXCOLORMODE will select from among the video
    modes supported by the current graphics adapter the one that has the
    highest resolution or the greatest number of colors.  The video mode
    will be selected from the standard modes, not including the SuperVGA
    modes.

    Selecting a new video mode resets the current output positions for
    graphics and text to be the top left corner of the screen.  The
    background color is reset to black and the default color value is set to
    be one less than the number of colors in the selected mode.

Returns:
    The _setvideomode function returns the number of text rows when the new
    mode is successfully selected; otherwise, zero is returned.

See Also:
    _getvideoconfig, _settextrows, _setvideomoderows

Example:
    #include <conio.h>
    #include <graph.h>
    #include <stdio.h>
    #include <stdlib.h>

    main()
    {
        int mode;
        struct videoconfig vc;
        char buf[ 80 ];

        _getvideoconfig( &vc );
        /* select "best" video mode */
        switch( vc.adapter ) {
        case _VGA :
        case _SVGA :
            mode = _VRES16COLOR;
            break;
        case _MCGA :
            mode = _MRES256COLOR;
            break;
        case _EGA :
            if( vc.monitor == _MONO ) {
                mode = _ERESNOCOLOR;
            } else {
                mode = _ERESCOLOR;
            }
            break;
        case _CGA :
            mode = _MRES4COLOR;
            break;
        case _HERCULES :
            mode = _HERCMONO;
            break;
        default :
            puts( "No graphics adapter" );
            exit( 1 );
        }
        if( _setvideomode( mode ) ) {
            _getvideoconfig( &vc );
            sprintf( buf, "%d x %d x %d\n", vc.numxpixels,
                             vc.numypixels, vc.numcolors );
            _outtext( buf );
            getch();
            _setvideomode( _DEFAULTMODE );
        }
    }

Classification:
    PC Graphics

Systems:
    DOS, QNX

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