Tscope5
textio01.c
////////////////////////////////////////////////////////////////////////////////
//
// __ ______
// / /_______________ ____ ___ / ____/
// / __/ ___/ ___/ __ \/ __ \/ _ \ /___ )
// / /_(__ ) /__/ /_/ / /_/ / __/ ____/ /
// \__/____/\___/\____/ .___/\___/ /_____/
// /_/
//
// textio01.c
// - Example of the text alignment functions.
////////////////////////////////////////////////////////////////////////////////
#include <tscope5.h>
int main()
{
// open a display
double w=600.0, h=600.0;
// left aligned, centered, right aligned
ts5_draw_line(0, -h/2, 0, h/2);
ts5_set_text_alignment(TS5_ALIGN_LEFT);
ts5_printf(0.0, 30.0, "left aligned text");
ts5_set_text_alignment(TS5_ALIGN_CENTER);
ts5_printf(0.0, 10.0, "centered text");
ts5_set_text_alignment(TS5_ALIGN_RIGHT);
ts5_printf(0.0, -10.0, "right aligned text");
// wait for a click
ts5_draw_mouse_button(ax(0.9), ay(-0.8));
// outlined text
double x=170.0;
double y;
double diff;
ts5_draw_line(-x, -h/2, -x, h/2);
ts5_draw_line(x, -h/2, x, h/2);
int i;
for(i=0; i<10; i++) {
y = w/4.0 - w/20.0*i;
diff = i * 20;
ts5_printf_justify (-x, x, y, diff, "some text (diff %03.0f)", diff);
ts5_draw_line(x, y, x-diff, y);
}
// wait for a click
ts5_draw_mouse_button(ax(0.9), ay(-0.8));
return 0;
}