diff options
| author | Adrian Kummerlaender | 2019-02-22 22:24:30 +0100 | 
|---|---|---|
| committer | Adrian Kummerlaender | 2019-02-22 22:24:30 +0100 | 
| commit | 9779fd7484f7af6d10ae28ca3763c6d938c341e3 (patch) | |
| tree | 715245275169857f70d07d516bb0bc41e14fff45 /src/glfw | |
| parent | f0b536ac93b3a9a49dfff8a7637f09b153a3b955 (diff) | |
| download | compustream-9779fd7484f7af6d10ae28ca3763c6d938c341e3.tar compustream-9779fd7484f7af6d10ae28ca3763c6d938c341e3.tar.gz compustream-9779fd7484f7af6d10ae28ca3763c6d938c341e3.tar.bz2 compustream-9779fd7484f7af6d10ae28ca3763c6d938c341e3.tar.lz compustream-9779fd7484f7af6d10ae28ca3763c6d938c341e3.tar.xz compustream-9779fd7484f7af6d10ae28ca3763c6d938c341e3.tar.zst compustream-9779fd7484f7af6d10ae28ca3763c6d938c341e3.zip | |
Tidy up wall drawing and geometry initialization
Diffstat (limited to 'src/glfw')
| -rw-r--r-- | src/glfw/window.cc | 21 | 
1 files changed, 10 insertions, 11 deletions
| diff --git a/src/glfw/window.cc b/src/glfw/window.cc index 4f14501..c0074ad 100644 --- a/src/glfw/window.cc +++ b/src/glfw/window.cc @@ -38,21 +38,20 @@ int Window::getHeight() const {  }  std::tuple<int,int,int> Window::getMouse() const { -	int state = 0; +	double x, y; +	glfwGetCursorPos(_handle, &x, &y); +	x = int(x -  getWidth()/2); +	y = int(getHeight()/2 - y); +  	if ( glfwGetMouseButton(_handle, GLFW_MOUSE_BUTTON_LEFT) == GLFW_PRESS ) { -		state = 1; -	} else if ( glfwGetMouseButton(_handle, GLFW_MOUSE_BUTTON_RIGHT) == GLFW_PRESS ) { -		state = 2; +		return std::make_tuple(1, x, y);  	} -	double x, y; -	glfwGetCursorPos(_handle, &x, &y); +	if ( glfwGetMouseButton(_handle, GLFW_MOUSE_BUTTON_RIGHT) == GLFW_PRESS ) { +		return std::make_tuple(2, x, y); +	} -	return std::make_tuple( -		state, -		x - int(getWidth()/2), -		int(getHeight()/2 - y) -	); +	return std::make_tuple(0, x, y);  }  KeyWatcher Window::getKeyWatcher(int key) const { | 
