Added a conservative set of key modifiers.

This commit is contained in:
Camilla Berglund
2012-12-09 19:19:00 +01:00
parent 7f2eb7b15b
commit 2d1b835711
24 changed files with 238 additions and 96 deletions
+2 -2
View File
@@ -43,7 +43,7 @@
void init( void );
void display( void );
void reshape( GLFWwindow* window, int w, int h );
void key_callback( GLFWwindow* window, int key, int action );
void key_callback( GLFWwindow* window, int key, int action, int mods );
void DrawBoingBall( void );
void BounceBall( double dt );
void DrawBoingBallBand( GLfloat long_lo, GLfloat long_hi );
@@ -245,7 +245,7 @@ void reshape( GLFWwindow* window, int w, int h )
0.0, -1.0, 0.0 ); /* up vector */
}
void key_callback( GLFWwindow* window, int key, int action )
void key_callback( GLFWwindow* window, int key, int action, int mods )
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
+2 -2
View File
@@ -211,13 +211,13 @@ static void animate(void)
/* change view angle, exit upon ESC */
void key( GLFWwindow* window, int k, int action )
void key( GLFWwindow* window, int k, int action, int mods )
{
if( action != GLFW_PRESS ) return;
switch (k) {
case GLFW_KEY_Z:
if( glfwGetKey( window, GLFW_KEY_LEFT_SHIFT ) )
if( mods & GLFW_MOD_SHIFT )
view_rotz -= 5.0;
else
view_rotz += 5.0;
+1 -1
View File
@@ -477,7 +477,7 @@ static void update_mesh(void)
* GLFW callback functions
*********************************************************************/
static void key_callback(GLFWwindow* window, int key, int action)
static void key_callback(GLFWwindow* window, int key, int action, int mods)
{
switch(key)
{
+2 -2
View File
@@ -414,7 +414,7 @@ static void cursorPosFun(GLFWwindow* window, double x, double y)
// Mouse button callback function
//========================================================================
static void mouseButtonFun(GLFWwindow* window, int button, int action)
static void mouseButtonFun(GLFWwindow* window, int button, int action, int mods)
{
if ((button == GLFW_MOUSE_BUTTON_LEFT) && action == GLFW_PRESS)
{
@@ -434,7 +434,7 @@ static void mouseButtonFun(GLFWwindow* window, int button, int action)
do_redraw = 1;
}
static void key_callback(GLFWwindow* window, int key, int action)
static void key_callback(GLFWwindow* window, int key, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
+2 -2
View File
@@ -270,7 +270,7 @@ static void error_callback(int error, const char* description)
// Handle key strokes
//========================================================================
void key_callback(GLFWwindow* window, int key, int action)
void key_callback(GLFWwindow* window, int key, int action, int mods)
{
if (action != GLFW_PRESS)
return;
@@ -313,7 +313,7 @@ void key_callback(GLFWwindow* window, int key, int action)
// Callback function for mouse button events
//========================================================================
void mouse_button_callback(GLFWwindow* window, int button, int action)
void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
{
if (button != GLFW_MOUSE_BUTTON_LEFT)
return;