🎉 Hardware cursor (SDL2-only)

Disabled by default because of these known issues:

1. When clicking on inventory item, it briefly appears a bit shifted (in the wrong coordinates).

   This issue can happen with software cursor as well, but is a lot more
   obvious with the hardware cursor.

2. Cursor is scaled with nearest-neighbour scaling, which may look a bit different from
   how the rest of the graphics are scaled.

See also previous attempt: https://github.com/diasurgical/devilutionX/pull/955 by @viciious

Co-authored-by: Victor Luchits <vluchits@gmail.com>
This commit is contained in:
Gleb Mazovetskiy 2021-06-18 13:03:38 +01:00 committed by Anders Jenbo
commit f9d20b44d6
20 changed files with 318 additions and 36 deletions

View file

@ -11,6 +11,7 @@
#include "dx.h"
#include "engine.h"
#include "engine/render/cel_render.hpp"
#include "hwcursor.hpp"
#include "init.h"
#include "loadsave.h"
#include "palette.h"
@ -179,8 +180,9 @@ static void DrawCutscene()
SDL_FillRect(out.surface, &rect, BarColor[progress_id]);
unlock_buf(1);
force_redraw = 255;
scrollrt_draw_game_screen(false);
BltFast(&rect, &rect);
RenderPresent();
}
void interface_msg_pump()
@ -218,10 +220,14 @@ void ShowProgress(interface_mode uMsg)
interface_msg_pump();
ClearScreenBuffer();
scrollrt_draw_game_screen(true);
scrollrt_draw_game_screen();
InitCutscene(uMsg);
BlackPalette();
DrawCutscene();
if (IsHardwareCursorEnabled())
SetHardwareCursorVisible(false);
PaletteFadeIn(8);
IncProgress();
sound_init();