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 Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <graph.h>
    short _FAR _selectpalette( short palnum );

Description:
    The _selectpalette function selects the palette indicated by the
    argument palnum from the color palettes available.  This function is
    only supported by the video modes _MRES4COLOR and _MRESNOCOLOR.

    Mode _MRES4COLOR supports four palettes of four colors.  In each
    palette, color 0, the background color, can be any of the 16 possible
    colors.  The color values associated with the other three pixel values,
    (1, 2 and 3), are determined by the selected palette.

    The following table outlines the available color palettes:


         Palette              Pixel Values
         Number    1               2               3

            0     green           red             brown
            1     cyan            magenta         white
            2     light green     light red       yellow
            3     light cyan      light magenta   bright white


Returns:
    The _selectpalette function returns the number of the previously
    selected palette.

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

    main()
    {
        int x, y, pal;

        _setvideomode( _MRES4COLOR );
        for( y = 0; y < 2; ++y ) {
            for( x = 0; x < 2; ++x ) {
                _setcolor( x + 2 * y );
                _rectangle( _GFILLINTERIOR,
                        x * 160, y * 100,
                        ( x + 1 ) * 160, ( y + 1 ) * 100 );
            }
        }
        for( pal = 0; pal < 4; ++pal ) {
            _selectpalette( pal );
            getch();
        }
        _setvideomode( _DEFAULTMODE );
    }

Classification:
    PC Graphics

Systems:
    DOS, QNX

See Also:
    _setvideomode, _getvideoconfig

See Also: _setvideomode _getvideoconfig

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