Commit Graph

22 Commits

Author SHA1 Message Date
Chris V. 04689419a8 Improve Emscripten build (#8312) 2026-05-21 05:39:30 +02:00
Anders Jenbo 005e7dcc23 chore: clang-tidy cleanup part 1 2026-04-03 22:57:48 +02:00
Gleb Mazovetskiy 705a007c22 SDL3: Fix nearest-neighbor scaling
For some reason, setting the scaling on just `texture` still results
in bluriness. However, setting the default scaling mode on the renderer
fixes it.

Also, does a few more things the SDL3 way.
2025-10-25 16:17:51 +02:00
Gleb Mazovetskiy db9404dcf6 CMake: Add SDL3_mixer
Requires a not-yet-released SDL 3.4.0.

I tried implementing audio with plain SDL and it's too complicated.
2025-10-23 17:54:33 +01:00
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 c6f635f881 RenderPresent: Update PalSurface in SDL2
When rendering directly to output surface, PalSurface may need to be
updated after a flip. This is not actually needed on DOS but may be
needed on other platforms in the future.
2025-09-02 10:56:54 +01: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
Anders Jenbo 1c76897f2c Apply simple const rules using clang-tidy 2025-08-16 01:21:36 +02:00
Gleb Mazovetskiy 903f0a8181 Simplify palette handling
Gets rid of `orig_palette`, we now always have only 2 palettes:

1. `logical_palette`

    This palette has color cycling / swapping applied but no global
    effects such as brightness / fade-in.

2. `system_palette`

   This palette is the actual palette used for rendering.

   It is usually `logical_palette` with the global brightness setting
   and fade-in/out applied.

Additionally, we now keep the k-d tree around and use it to
update single colors.

The colors that are color-cycled / swapped are never included
in the k-d tree, so the tree does not need updating on color
cycles/swaps.
2025-06-09 14:14:29 +01:00
Gleb Mazovetskiy 58fe44f836 init.h -> init.hpp 2025-05-18 22:37:09 +01:00
Gleb Mazovetskiy 3bb1d685af Extract current input mode into its own library
Removes a transitive dependency on the entire plrctrl from options.
2025-01-22 23:14:45 +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 d7647d6c63 More dependency untangling
1. Moves more assets-related stuff from `init` to `engine/assets`.
2. Removes `SDL_audiolib` dependency from `soundsample.h`.
3. Cleans up some unused/missing includes.
2025-01-09 18:19:44 +00: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
Gleb Mazovetskiy c31836eab8 Split up engine.{h,cpp}
Untangles dependencies by splitting up `engine.{h,cpp}` into 3 files:

1. `primitive_render`
2. `ticks` -- only contains `GetAnimationFrame` for now.
3. `GetWidth2` renamed to `CalculateSpriteTileCenterX` and moved to `levels/dun_tile.hpp`.
2025-01-09 08:51:55 +00:00
staphen 09ba7532ea At shutdown, free surfaces and textures allocated for virtual gamepad graphics 2024-11-11 21:21:48 +00: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
Gleb Mazovetskiy 580d3cb6ee touch/renderers: Migrate away from Art 2022-08-08 14:29:45 +01:00
Anders Jenbo ac2bf9aaac Limit what gets called in headless mode 2022-07-13 18:54:36 +02:00
Anders Jenbo 99181fd709 Move more files to the engine folder 2022-06-24 11:08:15 +02:00