Id parameter in mousePressed function

Hi. This is a very basic question, but it doesn’t seem to exist an entry in the documentation explaining it, hence my question here.

So really simply. What is the meaning of the parameter int id, in the touch and mouse functions?

For example in mousePressed(int x, int y, int id). What is id exactly?


Hi @nunos

The “id” is the button of the mouse that has been pressed … It allows you to identify which button was pressed, released or dragged …

These are the possible values that it can take …

#define OF_MOUSE_BUTTON_1      0
#define OF_MOUSE_BUTTON_2      1
#define OF_MOUSE_BUTTON_3      2
#define OF_MOUSE_BUTTON_4      3
#define OF_MOUSE_BUTTON_5      4
#define OF_MOUSE_BUTTON_6      5
#define OF_MOUSE_BUTTON_7      6
#define OF_MOUSE_BUTTON_8      7
1 Like

Wow. Thanks for your reply. Couldn’t be more informative and to the point. But, how would you know this? Didn’t I overlook same place in the documentation where this is mentioned? Thanks.

hi @nunos

The #define’s are defined in ofConstants.h.

I’ve found it just searching for OF_MOUSE_BUTTON in the whole OF … as i remembered it from long time.
I have no idea how is this intended to be documented …