Commit Graph
87 Commits
Author SHA1 Message Date
Gleb Mazovetskiy 88f706e0d1 SDL3: Add some backports / compat helpers 2025-10-10 00:49:44 +01:00
Gleb Mazovetskiy 1bbe8bfe08 SDL3: Even more migration 2025-10-09 01:28:37 +01:00
Gleb Mazovetskiy 8f6e9810d0 SDL3: Make text_render_integration_test build
Adds support for just enough SDL3 to make `text_render_integration_test`
work.
2025-10-05 20:17:47 +01:00
Gleb Mazovetskiy ea8a348371 SDL2: Improve best display mode selection (#8166) 2025-09-01 23:15:27 +02:00
Gleb Mazovetskiy 50ac397013 Add 8-bit video mode for SDL2 and use it in DOS
There are still some glitches in screen transitions but that's probably
our fault. We can improve it later.
2025-09-01 18:18:14 +01:00
Gleb Mazovetskiy c7b26690c4 dos: Switch to dos-vbe-rebase branch
Also cleans up dos-prep.sh and adds a bit of logging to display.cpp
2025-08-31 20:46:38 +01:00
Anders Jenbo 01507d532c Add basic DOS port (#8155) 2025-08-31 17:34:11 +02:00
Anders Jenbo 1c76897f2c Apply simple const rules using clang-tidy 2025-08-16 01:21:36 +02:00
staphen 45d7c79ba9 Remove unused function FreeRenderer() 2025-04-26 07:36:57 +02:00
obligaronandGleb Mazovetskiy fe853e484e Fix freezing the screen when changing the resolution by not recreating the renderer (#7953)
Co-authored-by: Gleb Mazovetskiy <[email protected]>
2025-04-25 10:40:01 +02:00
Gleb Mazovetskiy bae54d05e3 Options: Move resolutions list init to display.cpp 2025-01-23 21:04:02 +00:00
Gleb Mazovetskiy 88a9a0656d Move option change handlers out of options.cpp
Fixes #7638
2025-01-13 11:57:25 +00: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
Anders Jenbo 908fb47073 Merge limitFPS and vSync options (#7646) 2025-01-12 15:28:50 +01:00
Gleb Mazovetskiy a7651f15d9 Extract HeadlessMode from diablo.h
Untangles some dependencies.
Many places that use `HeadlessMode` do not need all of `diablo.h`.
2025-01-09 12:21:26 +00:00
staphen 1078598226 Hide Upscale option in Settings menu 2024-09-29 03:05:11 +02:00
Gleb Mazovetskiy 706905fd59 SDL1: Fix windowed video mode
On Ubuntu 24.04 when running in a window,
`SDL_GetVideoInfo` returns the display size rather than the window size,
resulting in incorrect scaling.

Using `SDL_GetVideoSurface` instead of `SDL_GetVideoInfo` fixes this.
2024-06-19 03:40:05 +01:00
Gleb Mazovetskiy c2ad6da733 Add DEVILUTIONX_DISPLAY_TEXTURE_FORMAT
Some platforms, such as PS2, can benefit from a different texture
format. Makes the texture format a CMake setting.
2023-09-03 00:48:06 +01:00
Gleb Mazovetskiy 62d067b653 Remove utils/stdcompat/abs.hpp 2023-08-14 01:54:29 +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 49574084e7 Use SDL_SetWindowDisplayMode() to resize fullscreen windows 2023-05-02 15:51:09 +02:00
Gleb Mazovetskiy 5bf9dfd7ee Demo mode: Force resolution to that of the demo 2023-01-12 03:38:29 +00:00
Gleb Mazovetskiy cffb2566df Fix timedemo on SDL1 2022-12-09 12:05:54 +01:00
Gleb Mazovetskiy 7a3882722e Text rendering and chat input fixes
1. Fixes the return value (bytes rendered).
2. Fixes line wrapping / end-of-rendering based on the given rectangle:
   1. Accounts for `BaseLineOffset`.
   2. Fixes an off-by-one error for the y coordinate.
   3. Wraps the cursor when needed.
3. Fix chat input box dimensions (height is 3 * line height).
4. Set the hint that indicates that we do not render the current
   IME suggestion (SDL_TEXTEDITING). This indicates to IME
   that it should render the suggestion instead.
2022-11-27 22:40:20 +00:00
Gleb Mazovetskiy 4e9bb0e704 Fix gold withdrawal in SDL1
1. Unifies SDL1 and SDL2 text input handling.
2. Moves game-specific text input handling out of misc_msg.
3. Disables Unicode processing when not inputting text in SDL1.

This fixes gold withdrawal in SDL1.
2022-11-27 20:09:54 +00:00
Gleb Mazovetskiy 680ab5ec40 Overhaul backbuffer state handling
When rendering directly to the output buffer, we need to maintain the
state of what has been drawn and what needs redrawing per-buffer.

We previously tried to do it implicitly by checking `SDL_DOUBLEBUF` and
other flags. The previous implementation was broken in several
ways, resulting in rendering issues on devices that support 8-bit output
directly.

Changes this mechanism to explicitly maintain buffer state per output
buffer. The new mechanism doesn't require knowledge of the number of
buffers, and thus also works correctly with triple-buffering.

Fixes #5447
2022-11-01 02:43:24 +00:00
staphen e67e4934cc Add padmapper for gamepad customization 2022-10-17 01:01:21 +02:00
Gleb Mazovetskiy ba34bafb3f Use SDL events directly
Removes redundant miniwin events and queue, using SDL events directly instead.

Demo migrated using this script: https://gist.github.com/glebm/8a73b04f695de96f344cc2e35151e03e
2022-08-03 03:50:19 +02:00
obligaron 40283ca69e Introduce timedemo based tests 2022-07-13 18:54:36 +02:00
Gleb Mazovetskiy 197e1180b2 Add StrCat and StrAppend
Adds simple string / integer concatenation functions.

Many of the uses of `fmt::format` are simply concatenation
of a few strings and integers.

`StrCat` is an easier-to-read alternative to such uses of `fmt`.
2022-07-10 06:14:58 +02:00
Anders Jenbo c7f19336c9 [xbox] Initialize the video system and specify search path 2022-07-09 18:50:53 +01:00
Gleb Mazovetskiy 4063afb792 Xbox NXDK platform 2022-07-09 18:50:53 +01:00
Anders Jenbo 99181fd709 Move more files to the engine folder 2022-06-24 11:08:15 +02:00
Andrew James 0add7a8af6 Define sizes using Size type in control.cpp/stash.cpp (#4737)
* Use appropriate types for size constants in control.cpp

* Declare constexpr value for iterating over the cells in a stash grid

* Use appropriate type for UIRectangle dimensions
2022-06-18 15:25:52 +02:00
Gleb Mazovetskiy 9d2948c782 Loading screen: Free the background early
Frees the background after blitting it once in the loading screen.
This gives the game more RAM for the actual loading.
2022-06-15 12:22:28 +02:00
Gleb Mazovetskiy ede7eab7e8 Fix -wnarrowing from SDL_Rect construction 2022-06-15 11:12:42 +01:00
obligaron d86c4e5d84 Introduce GetUIRectangle() to distinguish between UI and main panel 2022-05-29 20:20:44 +02:00
obligaron 5337bf1f6a Initialize Viewport in CalculatePanelAreas 2022-05-29 20:20:44 +02:00
ephphatha 7f15aa730d Move definition of ghMainWnd to utils/display.cpp
This variable is controlled/set by the code in that file, this also lets other files have more specific/relevant includes instead of the monolith that is diablo.h
2022-05-08 12:09:12 +02:00
Anders Jenbo 34201c7881 Do not set scaling hint with out a render 2022-04-13 18:54:01 +02:00
staphen 84475f29ae [Windows] Recreate the whole window if the renderer would otherwise freeze 2022-04-10 20:57:43 +02:00
Bubio 57d5fd0e62 Fix #4251 macOS mouse grab issue (#4298) 2022-04-02 12:32:32 +01:00
staphen 8d5b709749 Restore default Windows audio driver (WASAPI) 2022-02-03 06:40:59 +01:00
Felipe Wannmacher 8efbcf2058 Xbox One/Series support (#3946) 2022-01-17 12:37:29 +01:00
Anders Jenbo 0c109cbfb1 [touch] Update interface scaling when switching fullscreen mode 2022-01-02 11:37:38 +01:00
Anders Jenbo 6b2481a76c Touch support on all SDL2 platforms 2022-01-02 11:37:38 +01:00
Anders Jenbo 68e5805f1b [touch] Adjust controller position after changing resolution
Fixes #3791
2021-12-21 12:55:30 +01:00
Anders Jenbo cf9b5ae79d Split up graphics settings initializers 2021-12-21 12:55:30 +01:00
Anders Jenbo 0e2aac8cfe Allow for software based rendering 2021-12-21 12:55:30 +01:00
Anders Jenbo 24a15d90e2 Do not recreate the render when switching scalingn quality 2021-12-21 12:55:30 +01:00