Tscope5
mouse.c File Reference

Definitions of mouse functions. More...

Go to the source code of this file.

Functions

Response registration

The mouse can be used as a response device.

See timer.c for more information about response registration.

int ts5_define_mouse_button (int button)
 Define a mouse button as a response button. More...
 
int ts5_get_num_mouse_buttons ()
 Get the number of buttons available on the mouse. More...
 
Mouse GUI functions
void ts5_show_mouse ()
 Make the mouse cursor visible on the active display. More...
 
void ts5_hide_mouse ()
 Make the mouse cursor invisible on the active display. More...
 
void ts5_set_mouse_position (double x, double y)
 Move the mouse pointer to position (x,y). More...
 
void ts5_get_mouse_position (double *x, double *y)
 Get the horizontal and vertical position of the mouse pointer. More...
 
double ts5_get_mouse_x ()
 Get the horizontal position of the mouse pointer. More...
 
double ts5_get_mouse_y ()
 Get the vertical position of the mouse pointer. More...
 
void ts5_draw_mouse_button (double x, double y)
 Draw a mouse button and wait for a click. More...
 

Detailed Description

Definitions of mouse functions.

Definition in file mouse.c.

Function Documentation

int ts5_define_mouse_button ( int  button)

Define a mouse button as a response button.

Parameters
buttonNumber of the button (buttons are counted from 1).
Returns
The reponse number associated with the button.

Give a positive number if you want to monitor button press events, a negative number if you want to monitor button release events.

Examples:
mouse01.c, and mouse02.c.

Definition at line 46 of file mouse.c.

int ts5_get_num_mouse_buttons ( )

Get the number of buttons available on the mouse.

Returns
The number of buttons on the mouse.
Examples:
mouse01.c.

Definition at line 105 of file mouse.c.

void ts5_show_mouse ( )

Make the mouse cursor visible on the active display.

Definition at line 128 of file mouse.c.

void ts5_hide_mouse ( )

Make the mouse cursor invisible on the active display.

Examples:
mouse01.c.

Definition at line 143 of file mouse.c.

void ts5_set_mouse_position ( double  x,
double  y 
)

Move the mouse pointer to position (x,y).

Parameters
xHorizontal position of the mouse on the active display.
yVertical position of the mouse on the active display.
Examples:
mouse01.c, and mouse02.c.

Definition at line 161 of file mouse.c.

void ts5_get_mouse_position ( double *  x,
double *  y 
)

Get the horizontal and vertical position of the mouse pointer.

Parameters
xVariable that will store the horizontal position.
yVariable that will store the vertical position.

You can pass NULL for values you are not interested in.

Examples:
mouse02.c.

Definition at line 190 of file mouse.c.

double ts5_get_mouse_x ( )

Get the horizontal position of the mouse pointer.

Returns
The horizontal position of the mouse pointer.

Definition at line 251 of file mouse.c.

double ts5_get_mouse_y ( )

Get the vertical position of the mouse pointer.

Returns
The vertical position of the mouse pointer.

Definition at line 268 of file mouse.c.

void ts5_draw_mouse_button ( double  x,
double  y 
)

Draw a mouse button and wait for a click.

Parameters
xHorizontal position of the button on the active display.
yVertical position of the button on the active display.

The button color cannot be changed by the user. From version 0.6 onwards it changes with every new release of Tscope5. This way (almost) every Tscope5 program will have a built-in visual check of the up-to-dateness of your experiment computer.

Here is the list of version/color combinations:

  • Tscope5 0.6: Gulf Orange
  • Tscope5 <= 0.5: Chartreuse
Examples:
bitmaps01.c, bitmaps02.c, bitmaps03.c, bitmaps04.c, bitmaps05.c, cedrusbox01.c, display01.c, display01.cpp, display02.c, display03.c, display04.c, display05.c, display06.c, graphics01.c, graphics02.c, graphics03.c, graphics04.c, graphics05.c, graphics06.c, graphics07.c, graphics08.c, graphics09.c, graphics10.c, joystick01.c, keyboard01.c, mouse01.c, mouse02.c, parport01.c, primitives01.c, primitives02.c, primitives03.c, primitives04.c, randomizer01.c, randomizer02.c, randomizer03.c, serialport01.c, textio01.c, textio02.c, textio03.c, textio04.c, textio05.c, timer01.c, timer02.c, timer03.c, timer04.c, timer05.c, and timer06.c.

Definition at line 295 of file mouse.c.