Fix clicking causing the camera to flick

This commit is contained in:
Thinkofname 2016-04-08 11:44:23 +01:00
parent 3e8de93759
commit 6cfef5af2d
1 changed files with 6 additions and 5 deletions

View File

@ -299,14 +299,15 @@ fn handle_window_event(window: &sdl2::video::Window,
if game.server.is_connected() && !game.focused {
game.focused = true;
mouse.set_relative_mouse_mode(true);
mouse.warp_mouse_in_window(&window, (width/2) as i32, (height/2) as i32);
if !mouse.relative_mouse_mode() {
mouse.set_relative_mouse_mode(true);
}
return;
}
if mouse.relative_mouse_mode() {
mouse.set_relative_mouse_mode(false);
}
if !game.focused {
if mouse.relative_mouse_mode() {
mouse.set_relative_mouse_mode(false);
}
ui_container.click_at(game, x as f64, y as f64, width as f64, height as f64);
}
}