/*
          __
         / /_______________  ____  ___
        / __/ ___/ ___/ __ \/ __ \/ _ \
       / /_(__  ) /__/ /_/ / /_/ /  __/
       \__/____/\___/\____/ .___/\___/
                         /_/

    graphics3.c
    defining colors with r, g and b values
*/

#include <tscope.h>

// define a new color
#define MYCOLOR ts_makecolor(255,128,0)

int main()
{
    ts_scrsize(SIZE1);
    ts_init();

    // use predifined colors
    ts_bgcolor(WHITE);
    ts_fgcolor(BLACK);
    ts_printf_centre(0, 140, "Tscope knows some predefined colors");
    ts_fgcolor(BLUE);
    ts_printf_centre(0, 120, "BLUE for example");
    ts_fgcolor(RED);
    ts_printf_centre(0, 100, "RED is also an option");
    ts_fgcolor(BLACK);
    ts_printf_centre(0, 80,
                     "ts_makecolor mixes any color based on RGB-values");

    // use a new color defined with the preprocessor
    ts_fgcolor(MYCOLOR);
    ts_printf_centre(0, 40, "ts_makecolor can be used to #define a color");

    // assign a new color value to an integer
    // use that integer in a call to ts_fgcolor
    int mycolor2;
    mycolor2 = ts_makecolor(0, 128, 255);
    ts_fgcolor(mycolor2);
    ts_printf_centre(0, 0,
                     "its return value can be assigned to an integer");
    ts_printf_centre(0, -20, "which is used in a call to ts_fgcolor");

    // use ts_makecolor in argument list of a parameter function
    ts_fgcolor(ts_makecolor(128, 0, 255));
    ts_printf_centre(0, -60, "a call to ts_makecolor can even be used");
    ts_printf_centre(0, -80, "within a call to ts_fgcolor");

    // some more info
    ts_fgcolor(BLACK);
    ts_printf_centre(0, -120,
                     "other functions that take a color value as argument are");
    ts_printf_centre(0, -140, "ts_bgcolor, ts_textmode,");
    ts_printf_centre(0, -160, "ts_mousecolor and ts_clrbmp.");


    ts_button(XMAX - 20, -YMAX + 20);
    return 0;
}

END_OF_MAIN();


top
Persoonlijke pagina Universiteit GentTscope
Allegro | Cygwin | Gcc
© See license.html for copyright information