medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit e1c9f17f713396129117f440155fe73c9d4563e7
parent 5256e8aa392155d18d74aa31e6fd0fd615b7be57
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Wed Dec 28 21:48:20 +0200

IJKL for looking around

Diffstat:
hm.cc | 7+++++--
keys.h | 8++++----
main.cc | 8++++++--
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/hm.cc b/hm.cc @@ -193,8 +193,11 @@ extern "C" GAME_FRAME( game_frame ) { 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 ]; - const int yaw = input->keys[ KEY_RIGHTARROW ] - input->keys[ KEY_LEFTARROW ]; + int pitch = input->keys[ KEY_UPARROW ] - input->keys[ KEY_DOWNARROW ]; + int yaw = input->keys[ KEY_RIGHTARROW ] - input->keys[ KEY_LEFTARROW ]; + + pitch += input->keys[ KEY_I ] - input->keys[ KEY_K ]; + yaw += input->keys[ KEY_L ] - input->keys[ KEY_J ]; game->angles.x += pitch * dt * 2; game->angles.y += yaw * dt * 2; diff --git a/keys.h b/keys.h @@ -15,10 +15,10 @@ enum KeyNames { KEY_F = 'f', // KEY_G, // KEY_H, - // KEY_I, - // KEY_J, - // KEY_K, - // KEY_L, + KEY_I = 'i', + KEY_J = 'j', + KEY_K = 'k', + KEY_L = 'l', // KEY_M, // KEY_N, // KEY_O, diff --git a/main.cc b/main.cc @@ -151,12 +151,16 @@ int main( int argc, char ** argv ) { // TODO: do this properly GameInput input = { }; - 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_I ] = glfwGetKey( window, GLFW_KEY_I ) == GLFW_PRESS; + input.keys[ KEY_J ] = glfwGetKey( window, GLFW_KEY_J ) == GLFW_PRESS; + input.keys[ KEY_K ] = glfwGetKey( window, GLFW_KEY_K ) == GLFW_PRESS; + input.keys[ KEY_L ] = glfwGetKey( window, GLFW_KEY_L ) == GLFW_PRESS; + input.keys[ KEY_S ] = glfwGetKey( window, GLFW_KEY_S ) == GLFW_PRESS; input.keys[ KEY_T ] = glfwGetKey( window, GLFW_KEY_T ) == GLFW_PRESS; + input.keys[ KEY_W ] = glfwGetKey( window, GLFW_KEY_W ) == 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;