void Gource::mouseMove(SDL_MouseMotionEvent *e) { if(commitlog==0) return; if(gGourceSettings.hide_mouse) return; bool rightmouse = cursor.rightButtonPressed(); if(grab_mouse) { int warp_x = display.width/2; int warp_y = display.height/2; //this is an even we generated by warping the mouse below if(e->x == warp_x && e->y == warp_y) return; SDL_WarpMouse(warp_x, warp_y); } //move camera in direction the user dragged the mouse if(mousedragged || rightmouse) { vec2f mag( e->xrel, e->yrel ); //if right mouse button is held while dragging, rotate tree instead of //moving camera if(rightmouse) { manual_rotate = true; if(fabs(mag.x) > fabs(mag.y)) { rotate_angle = std::min(1.0f, (float) fabs(mag.x) / 10.0f) * 5.0f * DEGREES_TO_RADIANS; if(mag.x < 0.0f) rotate_angle = -rotate_angle; } else { rotate_angle = std::min(1.0f, (float) fabs(mag.y) / 10.0f) * 5.0f * DEGREES_TO_RADIANS; if(mag.y < 0.0f) rotate_angle = -rotate_angle; } return; } backgroundPos += mag; return; } if(grab_mouse) return; mousepos = vec2f(e->x, e->y); mousemoved=true; cursor.updatePos(mousepos); float pos; if(!gGourceSettings.hide_progress && slider.mouseOver(mousepos, &pos)) { std::string date = dateAtPosition(pos); slider.setCaption(date); } }
void Logstalgia::mouseMove(SDL_MouseMotionEvent *e) { mousepos = vec2(e->x, e->y); SDL_ShowCursor(true); mousehide_timeout = 5.0f; float pos; if(!settings.disable_progress && slider.mouseOver(mousepos, &pos)) { std::string date = dateAtPosition(pos); slider.setCaption(date); } }
void Gource::mouseMove(SDL_MouseMotionEvent *e) { if(commitlog==0) return; mousepos = vec2f(e->x, e->y); mousemoved=true; float pos; if(!gGourceDisableProgress && slider.mouseOver(mousepos, &pos)) { std::string date = dateAtPosition(pos); slider.setCaption(date); } }
void Gource::mouseMove(SDL_MouseMotionEvent *e) { if(commitlog==0) return; if(gGourceSettings.hide_mouse) return; Uint8 ms = SDL_GetMouseState(0,0); bool rightmouse = ms & SDL_BUTTON(SDL_BUTTON_RIGHT); //move camera in direction the user dragged the mouse if(mousedragged || rightmouse) { vec2f mag( e->xrel, e->yrel ); if(mag.length()>100.0) return; //if right mouse button is held while dragging, rotate tree instead of //moving camera if(rightmouse) { manual_rotate = true; rotate_angle = std::min(1.0f, (float) fabs(mag.x) / 10.0f) * 5.0f * DEGREES_TO_RADIANS; if(mag.x < 0.0) rotate_angle = -rotate_angle; return; } backgroundPos += mag; return; } mousepos = vec2f(e->x, e->y); mousemoved=true; float pos; if(!gGourceSettings.hide_progress && slider.mouseOver(mousepos, &pos)) { std::string date = dateAtPosition(pos); slider.setCaption(date); } }