summaryrefslogtreecommitdiff
path: root/src/video/sdl2_v.cpp
AgeCommit message (Collapse)Author
2021-02-14Fix: VkMapping declarations violated C++ ODR rule.milek7
2021-02-11Change: [SDL2] Remove unneeded delay of redrawing the screenPatric Stout
In testing, I could find no reason why this statement is here. The comment is rather unclear (it states what it does, but not why it would be needed). This line of code was introduced with f4f40448, which gives no further insight on why it would be needed to have it here. As such, let's remove it and see if anyone else reports any problems with it. If so, this commit can be reverted and a more clear comment should be added what this line of code is dealing with (the WHY, not the WHAT).
2021-02-11Codechange: [SDL2] Don't use globals if we can do with localsPatric Stout
2021-02-11Codechange: [SDL2] Name paint function Paint(), like other drivers doPatric Stout
This reduces confusion when reading different drivers.
2021-02-11Fix 30e69c51: palette was not marked dirty when creating a newPatric Stout
This means the code depended that the caller did this for us before MakePalette() is executed, which is neither a requirement nor a promise the code makes.
2021-02-06Fix #8029: [SDL2] disable draw-thread on wayland SDL video driver (#8648)Patric Stout
When the wayland SDL video driver is used, an EGL context is created in the main thread. It is not allowed to update this context from another thread, which is exactly what our draw-thread is trying. The other solution would be to move all of SDL into the draw-thread, but that would introduce a whole scala of different problems. The wayland SDL backend is significantly faster than the X11 SDL backend, but there is a performance hit nevertheless.
2021-02-05Codechange: Apply coding style (#8640)SamuXarick
* Fix: Missing or needed spaces * Codechange: Remove space * Codechange: Remove space * Codechange: More missing spaces * Codechange: Missing spaces * Codechange: Remove space * Codechange: Remove space
2021-01-30Codechange: [SDL2] Use MakeDirty() to force a redrawPatric Stout
The original code is "strictly correct", but just reads really weird, and we use MakeDirty() in several other places instead too.
2021-01-30Codechange: [SDL2] Rework how palette is updatedPatric Stout
It now follows more what the Win32 driver does, and has far less exceptions and special casing. MakePalette creates the Palette and prepares surface. UpdatePalette updates the Palette. CheckPaletteAnim checks if UpdatePalette needs to be called and marks the whole screen dirty so DrawSurfaceToScreen will do a full redraw.
2021-01-30Fix: [SDL2] Display why SDL_CreateWindow() failed in case it doesPatric Stout
All SDL_NNN errors print SDL_GetError, except for this one place.
2021-01-30Codechange: [SDL2] Split away CreateMainWindow from CreateMainSurfacePatric Stout
This makes the code a bit more readable, as both intentions are more clear, and there is less nesting in the main function.
2021-01-30Codechange: [SDL2] reworked the different surfaces to make it more readablePatric Stout
2021-01-30Codechange: [SDL2] Only prepare "caption" if you are going to us itPatric Stout
2021-01-30Codechange: [SDL2] Minor code cleanup to remove silly variablePatric Stout
2021-01-30Codechange: [SDL2] Only set _cur_palette, never _local_palettePatric Stout
2021-01-30Codechange: [SDL2] Move FindStartupDisplay to its own functionPatric Stout
2021-01-30Codechange: [SDL2] reworked FindResolutions to be more like the restPatric Stout
There was no default resolution fallback, and the code was different from the win32 driver. It is now named the same and much more similar.
2021-01-30Codechange: [SDL2] remove include-protectionPatric Stout
This is already done by CMake: if SDL2 is not detected, this file is not included.
2021-01-17Codechange: [SDL2/Win32] Be consistent how 0bpp blitters are not allowedPatric Stout
Sometimes it returned an usererror(), sometimes Start() failed. Now it always fails on Start(), so nothing else has to check again what blitter is used. AfterBlitterChange() can never change to a 0bpp, so it is sufficient to guard this with an assert().
2021-01-16Fix 0e62a398c7f: Only center the window, when it is smaller than the screen. ↵frosch
(#8581)
2021-01-14Add: [SDL2] video driver parameter to put OpenTTD on a particular display on ↵frosch
start. By default use the display where the mouse cursor is. (#8572)
2021-01-14Feature: Choose a sensible window size on a fresh OTTD config file. (#8536)Michael Lutz
2021-01-08Codechange: Remove min/max functions in favour of STL variants (#8502)Charles Pigott
2020-12-27Codechange: Use std::string in FIO search path handling.Michael Lutz
2020-12-15Add: [Emscripten] use "relative mouse mode" with SDL2Patric Stout
This mode doesn't wrap the mouse constantly, but requests SDL to lock the mouse pointer. This is needed, as with Emscripten you are not allowed to change the mouse poisition (only to lock it into place).
2020-12-15Add: support for emscripten (play-OpenTTD-in-the-browser)Patric Stout
Emscripten compiles to WASM, which can be loaded via HTML / JavaScript. This allows you to play OpenTTD inside a browser. Co-authored-by: milek7 <me@milek7.pl>
2020-12-15Codechange: unroll the SDL2 main loopPatric Stout
This commit prepares for the next commit, as Emscripten needs to have a way to trigger a single iteration of the main loop. To keep the real changes more clear, this commit only unrolls the loop, and makes no changes to the logic itself.
2020-06-18Fix #8104: Always add WINDOW_RESIZABLE flag to SDL2 (#8211)nikolas
This fixes a bug that can reproduced with these steps: * Start openttd in fullscreen mode * Turn off fullscreen mode * Try to resize the window. The window can't be resized.
2020-06-04Codechange: Realign SDL driver with SDL2 driver to ease maintenance and ↵TechGeekNZ
emphasise differences.
2020-05-21Codechange: Use std::string in the driver and blitter selection code.Michael Lutz
2020-01-15Fix: [SDL2] Correct name of the video driver in debug logxdavidwu
SDL_GetVideoDriver(0) returns name of first video driver included in the library, not the driver currently used. SDL_GetCurrentVideoDriver() does what we want here.
2019-11-10Cleanup: Removed SVN headersS. D. Cloudt
2019-11-10Fix #7783, Fix #7816: [SDL2] Fix input handling in edit contextJonathan G Rennison
In particular this fixes handling of the shift key
2019-11-10Change: [SDL2] Add an "unprintable" flag to struct VkMappingJonathan G Rennison
SDL_Keysym::sym is not suitable for checking whether the character is printable or not
2019-11-10Fix: [SDL2] Page down key not handledJonathan G Rennison
SDLK_PAGEUP and SDLK_PAGEDOWN are not sequential They must have separate entries in _vk_mapping
2019-11-10Fix: [SDL2] Detection of backtick scancodeJonathan G Rennison
SDL_Keysym::scancode is a SDL_SCANCODE_* constant, not a raw scan code
2019-11-01Fix #7784: up/down/home/end key behavior in SDL2Nikolas Nyby
Closes #7784.
2019-10-25Codechange: Don't use SDL_CreateRGBSurfaceWithFormat()Nikolas Nyby
This function requires libSDL 2.0.5 or higher. It looks like we don't need to use it, and can just use the original SDL_CreateRGBSurface(), with the masks set to 0, to trigger the default 8-bit format, which is SDL_PIXELFORMAT_INDEX8. Closes #7785 Note: this code path is activated by using an 8-bit blitter, like: ./bin/openttd -b 8bpp-simple
2019-09-19Add #6173: New SDL 2 based video and sound drivers (#7086)nikolas