]> git.lizzy.rs Git - nothing.git/commitdiff
(#767) Invert colors on the cursor
authorrexim <reximkut@gmail.com>
Sun, 31 Mar 2019 19:27:56 +0000 (02:27 +0700)
committerrexim <reximkut@gmail.com>
Sun, 31 Mar 2019 19:27:56 +0000 (02:27 +0700)
src/game.c

index d76fc9924c619a20300469e93ff3653c3e9d21c0..1200abb768aae4700d79e54f4693d790c516184a 100644 (file)
@@ -123,6 +123,18 @@ Game *create_game(const char *level_folder,
         lt,
         texture_from_bmp("images/cursor.bmp", renderer),
         SDL_DestroyTexture);
+    if (SDL_SetTextureBlendMode(
+            game->texture_cursor,
+            SDL_ComposeCustomBlendMode(
+                SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR,
+                SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR,
+                SDL_BLENDOPERATION_ADD,
+                SDL_BLENDFACTOR_ONE,
+                SDL_BLENDFACTOR_ZERO,
+                SDL_BLENDOPERATION_ADD)) < 0) {
+        log_fail("SDL error: %s\n", SDL_GetError());
+        RETURN_LT(lt, NULL);
+    }
     game->cursor_x = 0;
     game->cursor_y = 0;