Commit Graph
18 Commits
Author SHA1 Message Date
Anders Jenbo dc706e8ed5 Use HoldItem for determining if an item is held
This cleans up a bit of code and solves a few edge cases where an item
could be lost, the game be unresponsive, or miss fire an event during
lag cause of the cursor not reflecting the currently held item.
2022-04-18 11:27:07 +02:00
Gleb Mazovetskiy 21c64fd0af Hardware cursor: Simplify initialization
Set the palette at load time.

Since we only support hardware cursors in SDL2, we can take advantage of
its reference-counted palettes.
2022-04-14 01:21:24 +02:00
Gleb Mazovetskiy 79c7eee10a Mouse/Gamepad fixes
Introduces a `ControlDevice` global which is distinct from `ControlMode`
in that it is set to `Gamepad` even when simulating a mouse.

This allows us to avoid a number of edge cases related to mode changes.

Fixes #4242
2022-04-03 23:06:36 +01:00
obligaron 9a14edfcd9 Add OptionEntries for Hardware Cursor 2021-12-17 20:12:17 +01:00
obligaron af4f732ef1 Add OptionEntry Scaling Quality 2021-11-24 09:31:39 +01:00
Vladimir Olteanu aab7bf6e91 Make Palette a unique ptr 2021-09-13 23:07:04 +02:00
Gleb Mazovetskiy 1d48dd095d Scale hardware cursor bilinearly
Make the hardware cursor blurry like the rest of the screen.
2021-08-27 15:32:53 +02:00
Vladimir Olteanu bfcc57783c Remove Surface::{Alloc,Free}, introduce OwnedSurface 2021-08-19 08:51:59 +02:00
Vladimir Olteanu 2d4a205fef Introduce SDL::CreateRGBSurfaceWithFormat 2021-08-19 08:51:59 +02:00
ephphatha 949cb713d3 Add explicit casts to conversions from double/float to int 2021-07-08 07:53:40 -07:00
Gleb Mazovetskiy 65906f8332 🎉 Hardware cursor: Enable safe parts by default
Enables safe parts of the hardware cursor by default:

1. Disabled for items due to the jumping glitch.
2. Limited to 128px size due to buggy large cursors on some systems.
2021-07-08 09:06:35 +01:00
ephphatha 08ae390643 Add explicit casts for some implicit conversions
Some of these were triggering multiple warnings due to casts applied at times which forced potentially truncating operations.
2021-07-05 08:52:05 -07:00
Anders Jenbo 4eabc6024b Apply various cleanups via Android Studio 2021-07-03 18:27:17 -07:00
Gleb Mazovetskiy cb0dae8590 🚚 Rename CelOutputBuf to Surface and extract 2021-07-03 05:33:32 -07:00
Juliano Leal Goncalves a983792880 ♻️ Replace 'pair<int, int>' with 'Size' in 'GetItemSizeOnSlot' and 'GetInvItemSize' 2021-06-20 18:27:45 -07:00
Gleb Mazovetskiy 43bc08bd63 Hardware Cursor: Fall back to software on failure 2021-06-19 12:36:39 +01:00
Gleb Mazovetskiy 523d838bd4 Hardware Cursor: Use item hotpoint
For a hardware item cursor, set the hotpoint to the center
instead of manually setting the cursor position.
2021-06-19 12:36:39 +01:00
Gleb MazovetskiyandVictor Luchits f9d20b44d6 🎉 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 <[email protected]>
2021-06-19 01:03:40 +02:00