]> git.lizzy.rs Git - nothing.git/blobdiff - src/game.c
Close on Alt+F4 in case user's WM does not support it (e.g. i3)
[nothing.git] / src / game.c
index f9ea658371c1fb6b29eaa65bda9d9096d1aea540..7e59f094b5dccccd2476bb10a8a54adf6f105bdb 100644 (file)
@@ -40,6 +40,7 @@ typedef struct Game {
 
 void game_switch_state(Game *game, Game_state state)
 {
+    game->cursor.style = CURSOR_STYLE_POINTER;
     if (state == GAME_STATE_LEVEL_PICKER) {
         level_picker_clean_selection(&game->level_picker);
     }
@@ -104,7 +105,9 @@ Game *create_game(const char *level_folder,
                     SDL_BLENDFACTOR_ONE,
                     SDL_BLENDFACTOR_ZERO,
                     SDL_BLENDOPERATION_ADD)) < 0) {
-            log_warn("SDL error: %s\n", SDL_GetError());
+            log_warn("SDL error while setting blending mode for `%s': %s\n",
+                     cursor_style_tex_files[style],
+                     SDL_GetError());
         }
     }
 
@@ -226,7 +229,7 @@ int game_update(Game *game, float delta_time)
     } break;
 
     case GAME_STATE_LEVEL_PICKER: {
-        if (level_picker_update(&game->level_picker, delta_time) < 0) {
+        if (level_picker_update(&game->level_picker, &game->camera, delta_time) < 0) {
             return -1;
         }
 
@@ -410,7 +413,8 @@ int game_event(Game *game, const SDL_Event *event)
     } break;
 
     case SDL_KEYDOWN: {
-        if (event->key.keysym.sym == SDLK_q && event->key.keysym.mod & KMOD_CTRL) {
+        if ((event->key.keysym.sym == SDLK_q && event->key.keysym.mod & KMOD_CTRL) ||
+            (event->key.keysym.sym == SDLK_F4 && event->key.keysym.mod & KMOD_ALT)) {
             game_switch_state(game, GAME_STATE_QUIT);
             return 0;
         }