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

    graphics1.c
    parameter functions for setting colors and fill mode
*/

#include <tscope.h>

int main()
{
    ts_init();

    // 2 lines and a box
    ts_printf_centre(0, YMAX - 20, "default graphics parameters: ");
    ts_printf_centre(0, YMAX - 40, "white on a black background");
    ts_printf_centre(0, YMAX - 60, "text is transparent");
    ts_printf_centre(0, YMAX - 80, "volumes are not filled");
    ts_line(-XMAX, -YMAX, XMAX, YMAX);
    ts_line(XMAX, -YMAX, -XMAX, YMAX);
    ts_rect(XMAX / 2, -YMAX / 2, -XMAX / 2, YMAX / 2);

    ts_button(XMAX - 20, -YMAX + 20);
    ts_clrscr();

    // change some parameters
    ts_fill(ON);
    ts_bgcolor(WHITE);
    ts_fgcolor(BLUE);
    ts_printf_centre(0, YMAX - 20, "changing graphics parameters");
    ts_printf_centre(0, YMAX - 40, "has consequences on");
    ts_printf_centre(0, YMAX - 60, "all subsequent drawing");
    ts_circle(0, 0, 40);
    ts_printf_centre(0, -YMAX + 60, "and text");

    ts_button(XMAX - 20, -YMAX + 20);
    ts_clrscr();

    // some more changes
    ts_printf_centre(0, YMAX - 20, "new parameter values remain active");
    ts_fgcolor(RED);
    ts_printf_centre(0, YMAX - 40, "until they are changed again");
    ts_fill(OFF);
    ts_circle(0, 0, 40);

    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