Commit Graph
28 Commits
Author SHA1 Message Date
Gleb Mazovetskiy 1bbe8bfe08 SDL3: Even more migration 2025-10-09 01:28:37 +01:00
Anders Jenbo 1c76897f2c Apply simple const rules using clang-tidy 2025-08-16 01:21:36 +02:00
Gleb Mazovetskiy d94bc424df sgOptions -> GetOptions()
In C++, globals initialization order accross translation units is not
defined. Accessing a global via a function ensures that it is initialized.

This will be needed for #7638, which will statically initialize change
handlers after the Options object has been initialized.
2025-01-13 11:57:25 +00:00
Eric Robinson d7b5a0c972 Update hwcursor.cpp 2024-09-24 10:21:24 +02:00
Gleb Mazovetskiy a8f1d74bc4 Log an error if SDL_CreateColorCursor fails 2023-05-20 16:16:29 +01:00
Gleb Mazovetskiy f2d730a52f Delay hardware cursor reinit until it is visible
We previously reinitialized the hardware cursor during fade in even if
it was not visible (e.g. fading into the credits screen).
2023-05-20 15:33:41 +01:00
Gleb Mazovetskiy 2cf15cebc8 Add optional debug logging for hwcursor
To help debug hardware cursor issues
2023-05-20 14:44:13 +01:00
Gleb Mazovetskiy 4cf0053ece Set underlying type for all the enums
Reduces rg99 binary size by 3 KiB.
2022-08-11 01:43:54 +02:00
Gleb Mazovetskiy f3e37781d9 ArtCursor: Art -> CLX 2022-08-08 14:29:45 +01:00
Gleb Mazovetskiy 8ca71272b8 Load all CEL as CL2
Convert CEL files to CL2 at load time. CL2 format is more efficient and is about as fast to render.

CEL vs CL2 sizes, on dLvl 5: https://gist.github.com/glebm/9bbdd76962abcd4fd2405ecd3379af97

Memory:

* Peak memory (while loading): -300 KiB
* Memory in-game (dLvl5): -700 KiB
* RG99 binary size: -15 KiB (1333096 -> 1317192)

Performance on rg99:

* On average, -1 FPS in town.
* Same FPS in dungeon (20 FPS on dLvl 1).
2022-07-19 10:59:35 +02:00
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