Go to the previous, next section.

Mouse

AA-lib also provides a simple mouse interface. It needs to be initialized after the keyboard driver (and uninitialized before) since it uses it to report events. Its initialization is almost identical to keyboards (just replace kbd by mouse in function names). If you need more details read the keyboard section.

The only difference is mode parameter. It says what kind of events you should be informed about. It is a mask from the following fields: AA_MOUSEMOVEMASK, AA_MOUSEPRESSMASK and AA_PRESSEDMOVEMAKS. Note that mouse driver should ignore this mask. Set it to AA_MOUSEALLMASK to enables all these events.

Mouse event is reported by AA_MOUSE value returned by aa_getevent function. Then the mouse possition can be obtained using:

void aa_getmouse(aa_context *c, int *x, int *y, int *b);

X and y are reported in screen coordinates (not image ones). B contains state of buttons (AA_BUTTON1, AA_BUTTON2, AA_BUTTON3).

void aa_hidemouse(aa_context *c);
void aa_showmouse(aa_context *c);

This functions should be used to hide/show mouse cursor.

Go to the previous, next section.