commit 658623a3babaf9acded65a117353df12873ad471 parent 3c52cb7f64b84ac0e2467c9282e40b8c6d20a46e Author: Michael Savage <mikejsavage@gmail.com> Date: Sun Dec 11 14:21:56 +0200 USE KEY_X instead of 'x' Diffstat:
bsp.cc | | | 6 | +++--- |
hm.cc | | | 4 | ++-- |
keys.h | | | 12 | ++++++------ |
main.cc | | | 11 | ++++++----- |
mod_btt.cc | | | 4 | ++-- |
shadow_map.cc | | | 4 | ++-- |
diff --git a/bsp.cc b/bsp.cc @@ -342,8 +342,8 @@ struct FSData { }; extern "C" GAME_FRAME( game_frame ) { - const int fb = input->keys[ 'w' ] - input->keys[ 's' ]; - const int lr = input->keys[ 'a' ] - input->keys[ 'd' ]; + const int fb = input->keys[ KEY_W ] - input->keys[ KEY_S ]; + const int lr = input->keys[ KEY_A ] - input->keys[ KEY_D ]; const int dz = input->keys[ KEY_SPACE ] - input->keys[ KEY_LEFTSHIFT ]; const int pitch = input->keys[ KEY_UPARROW ] - input->keys[ KEY_DOWNARROW ]; @@ -374,7 +374,7 @@ extern "C" GAME_FRAME( game_frame ) { immediate_init( &imm, triangles, ARRAY_COUNT( triangles ) ); immediate_sphere( &imm, v3( 0, 0, 0 ), 128, v4( 1, 1, 0, 1 ) ); - if( input->keys[ 't' ] ) { + if( input->keys[ KEY_T ] ) { fix = true; fix_start = game->pos; fix_end = fix_start + forward * 1000.0f; diff --git a/hm.cc b/hm.cc @@ -170,8 +170,8 @@ static m4 camera_to_view( v3 position, v3 angles ) { extern "C" GAME_FRAME( game_frame ) { renderer_begin_frame( CLEARCOLOUR_DONT ); - const int fb = input->keys[ 'w' ] - input->keys[ 's' ]; - const int lr = input->keys[ 'a' ] - input->keys[ 'd' ]; + const int fb = input->keys[ KEY_W ] - input->keys[ KEY_S ]; + const int lr = input->keys[ KEY_A ] - input->keys[ KEY_D ]; const int dz = input->keys[ KEY_SPACE ] - input->keys[ KEY_LEFTSHIFT ]; const int pitch = input->keys[ KEY_UPARROW ] - input->keys[ KEY_DOWNARROW ]; diff --git a/keys.h b/keys.h @@ -7,12 +7,12 @@ enum KeyNames { KEY_NONE, - // KEY_A, + KEY_A = 'a', // KEY_B, // KEY_C, - // KEY_D, + KEY_D = 'd', // KEY_E, - // KEY_F, + KEY_F = 'f', // KEY_G, // KEY_H, // KEY_I, @@ -25,11 +25,11 @@ enum KeyNames { // KEY_P, // KEY_Q, // KEY_R, - // KEY_S, - // KEY_T, + KEY_S = 's', + KEY_T = 't', // KEY_U, // KEY_V, - // KEY_W, + KEY_W = 'w', // KEY_X, // KEY_Y, // KEY_Z, diff --git a/main.cc b/main.cc @@ -143,11 +143,12 @@ int main( int argc, char ** argv ) { // TODO: do this properly GameInput input = { }; - input.keys[ 'w' ] = glfwGetKey( window, GLFW_KEY_W ) == GLFW_PRESS; - input.keys[ 'a' ] = glfwGetKey( window, GLFW_KEY_A ) == GLFW_PRESS; - input.keys[ 's' ] = glfwGetKey( window, GLFW_KEY_S ) == GLFW_PRESS; - input.keys[ 'd' ] = glfwGetKey( window, GLFW_KEY_D ) == GLFW_PRESS; - input.keys[ 't' ] = glfwGetKey( window, GLFW_KEY_T ) == GLFW_PRESS; + input.keys[ KEY_W ] = glfwGetKey( window, GLFW_KEY_W ) == GLFW_PRESS; + input.keys[ KEY_A ] = glfwGetKey( window, GLFW_KEY_A ) == GLFW_PRESS; + input.keys[ KEY_S ] = glfwGetKey( window, GLFW_KEY_S ) == GLFW_PRESS; + input.keys[ KEY_D ] = glfwGetKey( window, GLFW_KEY_D ) == GLFW_PRESS; + input.keys[ KEY_F ] = glfwGetKey( window, GLFW_KEY_F ) == GLFW_PRESS; + input.keys[ KEY_T ] = glfwGetKey( window, GLFW_KEY_T ) == GLFW_PRESS; input.keys[ KEY_SPACE ] = glfwGetKey( window, GLFW_KEY_SPACE ) == GLFW_PRESS; input.keys[ KEY_LEFTSHIFT ] = glfwGetKey( window, GLFW_KEY_LEFT_SHIFT ) == GLFW_PRESS; input.keys[ KEY_UPARROW ] = glfwGetKey( window, GLFW_KEY_UP ) == GLFW_PRESS; diff --git a/mod_btt.cc b/mod_btt.cc @@ -237,8 +237,8 @@ extern "C" GAME_FRAME( game_frame ) { renderer_begin_frame( CLEARCOLOUR_DONT ); skybox_render( &game->skybox, game->angles, game->test_sun ); - const int fb = input->keys[ 'w' ] - input->keys[ 's' ]; - const int lr = input->keys[ 'a' ] - input->keys[ 'd' ]; + const int fb = input->keys[ KEY_W ] - input->keys[ KEY_S ]; + const int lr = input->keys[ KEY_A ] - input->keys[ KEY_D ]; const int dz = input->keys[ KEY_SPACE ] - input->keys[ KEY_LEFTSHIFT ]; const float dsun = ( input->keys[ KEY_EQUALS ] - input->keys[ KEY_MINUS ] ) * dt; diff --git a/shadow_map.cc b/shadow_map.cc @@ -103,8 +103,8 @@ static void update_camera( float speed = 6.0f; float angular_speed = 2.0f; - float dx = ( float ) input->keys[ 'a' ] - ( float ) input->keys[ 'd' ]; - float dy = ( float ) input->keys[ 'w' ] - ( float ) input->keys[ 's' ]; + float dx = ( float ) input->keys[ KEY_A ] - ( float ) input->keys[ KEY_D ]; + float dy = ( float ) input->keys[ KEY_W ] - ( float ) input->keys[ KEY_S ]; float dz = ( float ) input->keys[ KEY_SPACE ] - ( float ) input->keys[ KEY_LEFTSHIFT ]; v3 forward = angles_to_vector( angles );