Tscope5
Main Page
Related Pages
Files
Examples
display04.c
////////////////////////////////////////////////////////////////////////////////
//
// __ ______
// / /_______________ ____ ___ / ____/
// / __/ ___/ ___/ __ \/ __ \/ _ \ /___ )
// / /_(__ ) /__/ /_/ / /_/ / __/ ____/ /
// \__/____/\___/\____/ .___/\___/ /_____/
// /_/
//
// display04.c
// - Open two windowed displays on two display adapters (if available).
// - Count back from 10 to 0 (alternate between the displays).
// - Wait for a click.
//
// - If only one display adapter is available the output
// of this example is identical to display03.c.
// - If you have two display adapters but the driver is set to
// mirrored Tscope5 will think there is only one display adapter.
////////////////////////////////////////////////////////////////////////////////
#include <tscope5.h>
int
main()
{
// count the number of display adapters
int
n=
ts5_get_num_display_adapters
();
// open the two displays on a different
// display adapter if possible.
// otherwise put them on the same
// display adapters.
if
(n>1) {
ts5_set_display_adapter
(1);
ts5_install_display
();
ts5_set_display_adapter
(2);
ts5_install_display
();
}
else
{
double
w, h;
ts5_get_display_adapter_size
(1, &w, &h);
ts5_set_display_position
(-w/4.0, 0.0);
ts5_install_display
();
ts5_set_display_position
(w/4.0, 0.0);
ts5_install_display
();
}
// the code to draw the stimuli is identical to display03.c
// i.e. to the user it makes no difference whether we have
// two display adapters or only one.
int
i;
for
(i=10; i>=0; i--) {
ts5_clear_display
();
ts5_flip_display
();
ts5_set_active_display
(i%2 + 1);
ts5_printf
(0.0, 0.0,
"%d"
, i);
ts5_flip_display
();
ts5_wait
(0.5);
ts5_clear_display
();
}
// wait for a click
ts5_draw_mouse_button
(0.0,0.0);
return
0;
}