Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

Commit

Permalink
input: Disable MouseWatcher by default
Browse files Browse the repository at this point in the history
  • Loading branch information
PatchMixolydic committed Jan 10, 2019
1 parent 92c9713 commit f5919b4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions include/blackcomb/entities/BaseEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace blackcomb::entity {
BaseEntity();
void setPos(glm::vec3 position);
void setPos(float x, float y, float z);
glm::vec3 getPos();
void setX(float x);
void setY(float y);
void setZ(float z);
Expand Down
2 changes: 1 addition & 1 deletion include/blackcomb/input/MouseWatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace blackcomb::input {
public:
void update(base::Window& window);
glm::vec2 getMouseCoords();
static bool hasFocus; ///< Does the window have focus?
static bool shouldWatch; ///< Should we be watching for mouse input?
float mouseSensitivity = 0.05f; ///< Controls the sensitivity of mouse tracking.
private:
double lastMouseX = 400, lastMouseY = 300;
Expand Down
1 change: 0 additions & 1 deletion src/base/AppBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ namespace blackcomb::base {
getWindow().hide();
getWindow().setWindowTitle(winTitle);
getWindow().makeContextCurrent();
getWindow().setInputMode(GLFW_CURSOR, GLFW_CURSOR_DISABLED);

if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress)) {
throw misc::BlackcombException("Failed to initialize GLAD");
Expand Down
2 changes: 1 addition & 1 deletion src/entities/FreeMoveCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace blackcomb::entity {
setPos(pos + glm::normalize(glm::cross(front, up)) * speed * deltaTime);
}

if (!input::MouseWatcher::hasFocus) return;
if (!input::MouseWatcher::shouldWatch) return;

glm::vec2 mouseDelta = window.mouseWatcher.getMouseCoords();

Expand Down
4 changes: 2 additions & 2 deletions src/input/MouseWatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
#include "blackcomb/input/MouseWatcher.h"

namespace blackcomb::input {
bool MouseWatcher::hasFocus = true;
bool MouseWatcher::shouldWatch = false;

/**
* Update the mouse position.
* @param window The window to watch for mouse motion in.
* @return The change in mouse position.
*/
void MouseWatcher::update(base::Window& window) {
if (!hasFocus) {
if (!shouldWatch) {
mouseCoords = glm::vec2(0, 0);
return;
}
Expand Down

0 comments on commit f5919b4

Please sign in to comment.