diff options
Diffstat (limited to 'src/engine/M_game.c')
| -rw-r--r-- | src/engine/M_game.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/engine/M_game.c b/src/engine/M_game.c index 6295f51..0b2b14a 100644 --- a/src/engine/M_game.c +++ b/src/engine/M_game.c @@ -4,6 +4,7 @@ int M_initGame(M_Game *game, const char *window_title) { game->window_width = 1280; game->window_height = 720; + game->mouse_sens = 10.0f; SDL_Init( SDL_INIT_VIDEO @@ -17,6 +18,8 @@ int M_initGame(M_Game *game, const char *window_title) ); SDL_SetWindowRelativeMouseMode(game->window, 1); + game->render_info.render_distance = 40.0f; + M_setupProjection(90.0f, ((float)game->window_width)/((float)game->window_height), &game->render_info); game->block_atlas = M_createBlockAtlas(); @@ -42,6 +45,8 @@ int M_initGame(M_Game *game, const char *window_title) glClearColor(0.0f, 0.25f, 0.5f, 1.0f); glEnable(GL_DEPTH_TEST); +// glEnable(GL_CULL_FACE); +// glCullFace(GL_FRONT); return 0; } @@ -62,11 +67,14 @@ int M_handleEvents(M_Game *game) game->running = 0; break; case SDL_EVENT_KEY_DOWN: - SDL_SetWindowRelativeMouseMode(game->window, 0); + game->running = 0; break; case SDL_EVENT_MOUSE_MOTION: - game->player.camera.yaw += (float)event.motion.xrel/100; - game->player.camera.pitch += (float)event.motion.yrel/100; + M_Camera *camera = &game->player.camera; + camera->yaw += (float)event.motion.xrel * (game->mouse_sens/10); + camera->pitch += (float)event.motion.yrel * (game->mouse_sens/10); + if (camera->pitch > 90.0f) camera->pitch = 90.0f; + if (camera->pitch < -90.0f) camera->pitch = -90.0f; break; } } |
