/* Callback triggered when the video mode is set (or changed) It will recalibrate the mouse boundaries according to video mode width and height */ void PS2_UpdateMouse(_THIS) { if (mouseState == MOUSE_AVAILABLE) { //recalibrate PS2 mouse depending on video resolution, must be called at resolution change... int width = this->screen->w; int height = this->screen->h; // Set mouse boundaries PS2MouseSetBoundary(0, width, 0 , height); PS2MouseSetReadMode(PS2MOUSE_READMODE_DIFF); // Set initial mouse position, threshold and acceleration PS2MouseSetPosition(width/2, height/2); PS2MouseSetAccel(ACC_DEF); PS2MouseSetThres(THRES_DEF); printf("[PS2] Mouse calibrated for (0,0,%d,%d)\n[P22] with threshold %d and acceleration %f\n", width, height, THRES_DEF, ACC_DEF); } else if (mouseState == PAD_AVAILABLE) { //recalibrate PS2 pad depending on video resolution, must be called at resolution change... int width = this->screen->w; int height = this->screen->h; PADSTEP = width >> 7; printf("[PS2] Mouse Pad calibrated for (0,0,%d,%d)\n[P22] with threshold %d and acceleration %f\n", width, height, PADSTEP, 1.0); }
void Ps2Input::newRange(uint16 minx, uint16 miny, uint16 maxx, uint16 maxy) { _minx = minx; _miny = miny; _maxx = maxx; _maxy = maxy; if (_mouseLoaded) PS2MouseSetBoundary(minx, maxx, miny, maxy); warpTo(_posX, _posY); }