12 PS2Mouse::PS2Mouse(int xmax
, int ymax
)
18 fFd
= open("/dev/ps2mouse", 0);
24 void PS2Mouse::GetPos(int *out_x
, int *out_y
, int *out_buttons
)
30 err
= read(fFd
, &data
, sizeof(mouse_data
));
36 fXPos
+= data
.delta_x
;
43 fYPos
+= data
.delta_y
;
48 *out_y
= fYMax
- fYPos
;
51 *out_buttons
|= (data
.status
& 0x80) ? MAIN_BUTTON
: 0;
52 *out_buttons
|= (data
.status
& 0x40) ? SECONDARY_BUTTON
: 0;
53 *out_buttons
|= (data
.status
& 0x20) ? TERTIARY_BUTTON
: 0;