Skip to content

Commit

Permalink
ENGINES: Enable free look when pressing the middle mouse button
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Mar 21, 2014
1 parent c9fdb72 commit f799acc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/engines/kotor/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,17 @@ void Module::handleEvents() {
}

bool Module::handleCamera(const Events::Event &e) {
if (e.type != Events::kEventKeyDown)
if (e.type != Events::kEventKeyDown) {
if (e.type == Events::kEventMouseMove) {
if (e.motion.state & SDL_BUTTON(2)) {
CameraMan.pitch(-Common::deg2rad(0.5) * e.motion.yrel);
CameraMan.rotate(-Common::deg2rad(0.5) * e.motion.xrel, 0.0, 1.0, 0.0);
return true;
}
}

return false;
}

float speed = (e.key.keysym.mod & KMOD_SHIFT) ? 1.0 : 0.5;

Expand Down
11 changes: 10 additions & 1 deletion src/engines/nwn/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,17 @@ void Module::handleEvents() {
}

bool Module::handleCamera(const Events::Event &e) {
if (e.type != Events::kEventKeyDown)
if (e.type != Events::kEventKeyDown) {
if (e.type == Events::kEventMouseMove) {
if (e.motion.state & SDL_BUTTON(2)) {
CameraMan.pitch(-Common::deg2rad(0.5) * e.motion.yrel);
CameraMan.rotate(-Common::deg2rad(0.5) * e.motion.xrel, 0.0, 1.0, 0.0);
return true;
}
}

return false;
}

float speed = (e.key.keysym.mod & KMOD_SHIFT) ? 1.0 : 0.5;

Expand Down

0 comments on commit f799acc

Please sign in to comment.