59 Commits
Author SHA1 Message Date
obligaron 426dd4c4af Add scroll wheel support to keymapper 2023-12-14 22:17:57 +01:00
obligaron d3bdd4b8cc Change DiabloUI list callbacks indexes from int to size_t 2023-11-25 11:43:37 +01:00
obligaron 2b15eb8d03 Fix MSVC warnings from headers 2023-11-07 00:27:42 +01:00
Gleb Mazovetskiy 26f42520fa Fix unused variable warnings 2023-08-16 06:02:17 +09:00
Gleb Mazovetskiy 8c1a847f41 Remove utils/stdcompat/string_view.hpp 2023-08-14 09:59:14 +01:00
Gleb Mazovetskiy 14540164a7 Remove utils/stdcompat/optional.hpp 2023-08-14 01:54:29 +01:00
Gleb Mazovetskiy de081b7080 Fix a few compilation warnings 2023-07-12 12:35:06 +01:00
Gleb Mazovetskiy 4fa3732526 Add missing <cstdint> includes
Done with the following script:

```ruby
Dir["Source/**/*.{h,c,cc,cpp,hpp}"].each do |path|
  v = File.read(path)
  next if !v.include?("uint32_t") || v.include?("cstdint")

  lines = v.lines
  line_num = if lines[2].start_with?(" *")
    lines.index { |l| l.start_with?(" */") } + 3
  else
    3
  end

  lines.insert(line_num, "#include <cstdint>\n")

  File.write(path, lines.join(""))
end
```

then fixed-up manually
2023-05-10 13:50:12 +01:00
staphen 5995e7da38 Fix OOB vector access when toggling fullscreen in settings menu 2023-05-02 15:51:09 +02:00
staphen 71ccd415c5 Update gamepad motion state regardless of the active event handler 2023-04-16 08:49:30 +02:00
Gleb Mazovetskiy c858ab4d2c Fix some compilation warnings
also removes a couple of unused filesystem includes
2023-03-12 13:21:40 +00:00
Gleb Mazovetskiy f7580f188c Fix multiline DrawStringWithColors alignment
For center or right alignment, the lines past the first line were
aligned incorrectly. The alignment was based on the width of the
format string.
2023-02-14 09:42:14 +00:00
Gleb Mazovetskiy 1788d2f8ec Remove miniwin
Event handling code moved to `engine/events.{hpp,cpp}`.
2023-02-01 16:06:57 +00:00
obligaron 7a1f962e33 Settingsmenu: Create submenus for each category 2023-01-05 00:47:58 +01:00
qndel efaf334965 typos and code cleanup 2022-12-19 17:34:15 +01:00
staphen b66b6c611b Produce multiple controller button events for SDL_JOYHATMOTION events 2022-12-05 05:05:07 +01:00
Gleb Mazovetskiy 1e20a5721f Settings menu: Fix description clipping
Adjust description dimensions to make it fit exactly 3 lines for CJK.
Previously, the second line was clipped since we fixed the clipping.
2022-11-27 22:40:20 +00:00
staphen f17ea8db98 Implement settings menu for gamepad customization 2022-11-27 18:27:21 +01:00
Gleb Mazovetskiy 6dca019de2 Use function_ref instead of function
`function_ref` is a lightweight function pointer,
whereas `std::function` always involves a heap allocation.
2022-11-02 11:46:15 +00:00
Gleb Mazovetskiy 0498d7d3a7 Fix compilation warnings 2022-10-29 13:41:23 +01:00
Gleb Mazovetskiy 41f43ea3f5 Support unpacked MPQs from devilutionx-mpq-tools
https://github.com/diasurgical/devilutionx-mpq-tools produces an unpacked MPQ
with all the graphics converted to CLX and the unused files removed.
This is primarily useful on RAM-constrained platforms, such as PS2,
because it eliminates the MPQ overhead.

Adds a build option to load from such unpacked directories instead of the MPQ.

These directories are searched for in the same locations
where the MPQs would be searched for otherwise.

Example directory layout:

* /usr/local/share/diasurgical/devilutionx/diabdat/ -- unpacked and converted diabdat.mpq
* /usr/local/share/diasurgical/devilutionx/hellfire/ -- unpacked and converted hellfire MPQs (all of them merged into 1 directory)
* /usr/local/share/diasurgical/devilutionx/fonts/ -- unpacked fonts.mpq
* /usr/local/share/diasurgical/devilutionx/pl/ -- unpacked pl.mpq

These directory structure is produced by calling `unpack_and_minify_mpq`
2022-10-11 18:00:57 +01:00
staphen 6b7b0d3498 Fix error mapping keys when typing lowercase characters 2022-09-13 10:36:41 +02: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 961866e1c4 CLX: A new graphics format
The format is almost identical to CL2, except it uses the frame header
to store frame width and height instead of 5 32-line offsets.

This means we always have access to frame dimensions, so we can use it
as an on-disk format for our graphics as well.

Additionally, we may be able to optimize the rendering even more
in the future now that we have guaranteed knowledge of frame dimensions.
2022-08-03 02:38:55 +02:00
Gleb Mazovetskiy 0cd035ef61 Load PCX as CL2
Similar to #5059, which converted CEL to CL2 at load time,
we now do the same for PCX.

Some size stats: https://gist.github.com/glebm/067bf1ec73f9d14514932cfe237e4e8e

Notably, fonts RAM usage is decreased by ~35%.
2022-07-20 22:58:15 +01:00
Gleb Mazovetskiy a4ac41cece Replace DVL_VK virtual key codes with SDLK 2022-07-17 10:00:06 +01:00
Anders Jenbo 3ae834148a Split event handeling from general miniwin features 2022-07-10 21:13:39 +02:00
Anders Jenbo 2d21fc372e Remove more miniwin code 2022-07-10 21:13:39 +02:00
Gleb Mazovetskiy ad7ca97ae1 Fix black background palette (#4831)
Diablo and Hellfire have different palettes in `ui_art\black.pcx`.

We now ship our own tiny `black.pcx` that takes priority over the
other ones. This `black.pcx` had the Diablo palette which resulted in an
incorrect palette in the Settings screen.

Split our own `black.pcx` file into `black_diablo.pcx` and
`black_hellfire.pcx` and load the correct one depending on the mode.
2022-07-01 18:17:18 +02:00
Andrew James 13a3424ff0 Add helpers for creating/using Rectangles in UI contexts (#4734)
* Add MakeRectangle helper to convert from SDL_Rect

* Add Rectangle::inset method for shrinking a rectangle

Turns out some of the other use cases I though this could apply to were actually doing something based on a fixed region

* Simplify initialisation of settings menu rects
2022-06-19 15:18:48 +02:00
Gleb Mazovetskiy 5df03f56e3 DiabloUI: Render scrollbar as PCX 2022-06-13 09:54:01 +01:00
Gleb Mazovetskiy 9e9b656b88 DiabloUI: Render backgrounds as PCX
The backgrounds can be quite large, for example
the Hellfire title background is a 2.4 MiB PCX file.

Previously, we converted all background to SDL surfaces.
This required extra memory, e.g. the 2.4 MiB Hellfire
title background uses 4.6 MiB as an SDL surface.

Changes the background to render directly from PCX instead
to reduce the allocator pressure.
2022-06-13 09:54:01 +01:00
obligaron d86c4e5d84 Introduce GetUIRectangle() to distinguish between UI and main panel 2022-05-29 20:20:44 +02:00
Gleb Mazovetskiy ade8aba822 Fix some more warnings 2022-04-14 01:26:29 +02:00
Anders Jenbo 1409e604f5 Reduce string conversions 2022-03-20 11:04:15 +01:00
Anders Jenbo 422f2bae9d Fix build warnings 2022-03-15 04:39:14 +01:00
staphen df830f6495 Save settings before leaving the settings menu 2022-01-23 05:25:48 +01:00
obligaron b3a9760bda Keymapper: Add mouse support 2022-01-15 15:31:48 +01:00
obligaron 150a4edfdb Settingsmenu: Use two lines if text doesn't fix in one line 2022-01-06 18:45:14 +01:00
obligaron 18fb40ee32 Settingsmenu: Implement KeyInput 2021-12-23 00:26:12 +01:00
staphen af59f7e254 Update fullscreen option in settings menu after Alt+Enter 2021-12-21 12:55:30 +01:00
obligaron b9c98ef116 settingsmenu: In list selection show option description 2021-12-18 19:35:16 +01:00
obligaron 9a14edfcd9 Add OptionEntries for Hardware Cursor 2021-12-17 20:12:17 +01:00
qndel 115e8ad0ff ShownMenuTyp -> ShownMenuType 2021-12-05 22:21:33 +01:00
obligaron 9f478a5851 Settingsmenu: Add list browsing 2021-12-05 17:23:41 +01:00
obligaron 8a235186f2 Settingsmenu: Clean up UI-Resources before switching options that require RecreateUI 2021-12-04 15:36:11 +01:00
obligaron db392c84b0 Add OptionEntry Shareware and remove specials from settingsmenu 2021-12-02 01:08:33 +01:00
obligaron b5ab9758d0 Replace gbSpawned with gbIsSpawn 2021-12-02 01:08:33 +01:00
obligaron 88ffa9f98a Options: Move Diablo/Hellfire option to StartUp and integrate in Settings Dialog 2021-12-02 01:08:33 +01:00
obligaron 20fbd46886 Add OptionEntryFlags::NeedDiabloMpq/NeedHellfireMpq 2021-12-02 01:08:33 +01:00