mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 19:42:00 +00:00
Fixed key names in the example and test programs.
This commit is contained in:
parent
3b0084799c
commit
e3cb563a28
@ -608,7 +608,7 @@ int main( void )
|
|||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
|
|
||||||
/* Check if we are still running */
|
/* Check if we are still running */
|
||||||
running = glfwIsWindow(window) && !glfwGetKey( window, GLFW_KEY_ESC );
|
running = glfwIsWindow(window) && !glfwGetKey( window, GLFW_KEY_ESCAPE );
|
||||||
}
|
}
|
||||||
while( running );
|
while( running );
|
||||||
|
|
||||||
|
@ -220,13 +220,13 @@ void key( GLFWwindow window, int k, int action )
|
|||||||
if( action != GLFW_PRESS ) return;
|
if( action != GLFW_PRESS ) return;
|
||||||
|
|
||||||
switch (k) {
|
switch (k) {
|
||||||
case 'Z':
|
case GLFW_KEY_Z:
|
||||||
if( glfwGetKey( window, GLFW_KEY_LSHIFT ) )
|
if( glfwGetKey( window, GLFW_KEY_LEFT_SHIFT ) )
|
||||||
view_rotz -= 5.0;
|
view_rotz -= 5.0;
|
||||||
else
|
else
|
||||||
view_rotz += 5.0;
|
view_rotz += 5.0;
|
||||||
break;
|
break;
|
||||||
case GLFW_KEY_ESC:
|
case GLFW_KEY_ESCAPE:
|
||||||
running = 0;
|
running = 0;
|
||||||
break;
|
break;
|
||||||
case GLFW_KEY_UP:
|
case GLFW_KEY_UP:
|
||||||
|
@ -497,7 +497,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
|||||||
{
|
{
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case GLFW_KEY_ESC:
|
case GLFW_KEY_ESCAPE:
|
||||||
/* Exit program on Escape */
|
/* Exit program on Escape */
|
||||||
running = GL_FALSE;
|
running = GL_FALSE;
|
||||||
break;
|
break;
|
||||||
|
@ -493,7 +493,7 @@ int main(void)
|
|||||||
|
|
||||||
} // Check if the ESC key was pressed or the window was closed
|
} // Check if the ESC key was pressed or the window was closed
|
||||||
while (glfwIsWindow(window) &&
|
while (glfwIsWindow(window) &&
|
||||||
glfwGetKey(window, GLFW_KEY_ESC) != GLFW_PRESS);
|
glfwGetKey(window, GLFW_KEY_ESCAPE) != GLFW_PRESS);
|
||||||
|
|
||||||
// Close OpenGL window and terminate GLFW
|
// Close OpenGL window and terminate GLFW
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
@ -83,7 +83,7 @@ int main(void)
|
|||||||
|
|
||||||
} // Check if the ESC key was pressed or the window was closed
|
} // Check if the ESC key was pressed or the window was closed
|
||||||
while (glfwIsWindow(window) &&
|
while (glfwIsWindow(window) &&
|
||||||
glfwGetKey(window, GLFW_KEY_ESC) != GLFW_PRESS);
|
glfwGetKey(window, GLFW_KEY_ESCAPE) != GLFW_PRESS);
|
||||||
|
|
||||||
// Close OpenGL window and terminate GLFW
|
// Close OpenGL window and terminate GLFW
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
@ -262,7 +262,7 @@ void key_callback(GLFWwindow window, int key, int action)
|
|||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case GLFW_KEY_ESC:
|
case GLFW_KEY_ESCAPE:
|
||||||
running = 0;
|
running = 0;
|
||||||
break;
|
break;
|
||||||
case GLFW_KEY_SPACE:
|
case GLFW_KEY_SPACE:
|
||||||
@ -280,11 +280,11 @@ void key_callback(GLFWwindow window, int key, int action)
|
|||||||
case GLFW_KEY_DOWN:
|
case GLFW_KEY_DOWN:
|
||||||
beta += 5;
|
beta += 5;
|
||||||
break;
|
break;
|
||||||
case GLFW_KEY_PAGEUP:
|
case GLFW_KEY_PAGE_UP:
|
||||||
if (zoom > 1)
|
if (zoom > 1)
|
||||||
zoom -= 1;
|
zoom -= 1;
|
||||||
break;
|
break;
|
||||||
case GLFW_KEY_PAGEDOWN:
|
case GLFW_KEY_PAGE_DOWN:
|
||||||
zoom += 1;
|
zoom += 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -99,7 +99,7 @@ static const char* get_key_name(int key)
|
|||||||
case GLFW_KEY_WORLD_2: return "WORLD 2";
|
case GLFW_KEY_WORLD_2: return "WORLD 2";
|
||||||
|
|
||||||
// Function keys
|
// Function keys
|
||||||
case GLFW_KEY_ESC: return "ESCAPE";
|
case GLFW_KEY_ESCAPE: return "ESCAPE";
|
||||||
case GLFW_KEY_F1: return "F1";
|
case GLFW_KEY_F1: return "F1";
|
||||||
case GLFW_KEY_F2: return "F2";
|
case GLFW_KEY_F2: return "F2";
|
||||||
case GLFW_KEY_F3: return "F3";
|
case GLFW_KEY_F3: return "F3";
|
||||||
|
@ -49,7 +49,7 @@ static void window_key_callback(GLFWwindow window, int key, int action)
|
|||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case GLFW_KEY_ESC:
|
case GLFW_KEY_ESCAPE:
|
||||||
{
|
{
|
||||||
printf("%0.3f: User pressed Escape\n", glfwGetTime());
|
printf("%0.3f: User pressed Escape\n", glfwGetTime());
|
||||||
running = GL_FALSE;
|
running = GL_FALSE;
|
||||||
|
@ -51,35 +51,35 @@ static void key_callback(GLFWwindow window, int key, int action)
|
|||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case GLFW_KEY_ESC:
|
case GLFW_KEY_ESCAPE:
|
||||||
glfwCloseWindow(window);
|
glfwCloseWindow(window);
|
||||||
break;
|
break;
|
||||||
case 'Q':
|
case GLFW_KEY_Q:
|
||||||
ggamma += 0.1f;
|
ggamma += 0.1f;
|
||||||
printf("Gamma: %f\n", ggamma);
|
printf("Gamma: %f\n", ggamma);
|
||||||
glfwSetGammaFormula( ggamma, gblacklevel, ggain );
|
glfwSetGammaFormula( ggamma, gblacklevel, ggain );
|
||||||
break;
|
break;
|
||||||
case 'W':
|
case GLFW_KEY_W:
|
||||||
ggamma -= 0.1f;
|
ggamma -= 0.1f;
|
||||||
printf("Gamma: %f\n", ggamma);
|
printf("Gamma: %f\n", ggamma);
|
||||||
glfwSetGammaFormula( ggamma, gblacklevel, ggain );
|
glfwSetGammaFormula( ggamma, gblacklevel, ggain );
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case GLFW_KEY_A:
|
||||||
ggain += 0.1f;
|
ggain += 0.1f;
|
||||||
printf("Gain: %f\n", ggain);
|
printf("Gain: %f\n", ggain);
|
||||||
glfwSetGammaFormula( ggamma, gblacklevel, ggain );
|
glfwSetGammaFormula( ggamma, gblacklevel, ggain );
|
||||||
break;
|
break;
|
||||||
case 'S':
|
case GLFW_KEY_S:
|
||||||
ggain -= 0.1f;
|
ggain -= 0.1f;
|
||||||
printf("Gain: %f\n", ggain);
|
printf("Gain: %f\n", ggain);
|
||||||
glfwSetGammaFormula( ggamma, gblacklevel, ggain );
|
glfwSetGammaFormula( ggamma, gblacklevel, ggain );
|
||||||
break;
|
break;
|
||||||
case 'Z':
|
case GLFW_KEY_Z:
|
||||||
gblacklevel += 0.1f;
|
gblacklevel += 0.1f;
|
||||||
printf("Black Level: %f\n", gblacklevel);
|
printf("Black Level: %f\n", gblacklevel);
|
||||||
glfwSetGammaFormula( ggamma, gblacklevel, ggain );
|
glfwSetGammaFormula( ggamma, gblacklevel, ggain );
|
||||||
break;
|
break;
|
||||||
case 'X':
|
case GLFW_KEY_X:
|
||||||
gblacklevel -= 0.1f;
|
gblacklevel -= 0.1f;
|
||||||
printf("Black Level: %f\n", gblacklevel);
|
printf("Black Level: %f\n", gblacklevel);
|
||||||
glfwSetGammaFormula( ggamma, gblacklevel, ggain );
|
glfwSetGammaFormula( ggamma, gblacklevel, ggain );
|
||||||
|
@ -54,7 +54,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
|||||||
case GLFW_KEY_SPACE:
|
case GLFW_KEY_SPACE:
|
||||||
glfwIconifyWindow(window);
|
glfwIconifyWindow(window);
|
||||||
break;
|
break;
|
||||||
case GLFW_KEY_ESC:
|
case GLFW_KEY_ESCAPE:
|
||||||
glfwCloseWindow(window);
|
glfwCloseWindow(window);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ static void key_callback(GLFWwindow window, int key, int action)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'R':
|
case GLFW_KEY_R:
|
||||||
{
|
{
|
||||||
if (action == GLFW_PRESS)
|
if (action == GLFW_PRESS)
|
||||||
{
|
{
|
||||||
|
@ -73,8 +73,8 @@ static void key_callback(GLFWwindow window, int key, int action)
|
|||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case 'Q':
|
case GLFW_KEY_Q:
|
||||||
case GLFW_KEY_ESC:
|
case GLFW_KEY_ESCAPE:
|
||||||
closed = GL_TRUE;
|
closed = GL_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
static void key_callback(GLFWwindow window, int key, int action)
|
static void key_callback(GLFWwindow window, int key, int action)
|
||||||
{
|
{
|
||||||
if (action == GLFW_PRESS && key == GLFW_KEY_ESC)
|
if (action == GLFW_PRESS && key == GLFW_KEY_ESCAPE)
|
||||||
glfwCloseWindow(window);
|
glfwCloseWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user