summaryrefslogtreecommitdiff
path: root/src/video
AgeCommit message (Collapse)Author
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-17Codechange: [Win32] Use _local_palette for most operationsPatric Stout
Other drivers do this too, and this makes the world a bit more the same.
2021-01-17Codechange: [Win32] use CSleep() instead of Sleep() like everywhere elsePatric Stout
Functional it is identical. Just helps future-us when searching for sleeps.
2021-01-17Codechange: [Win32] Use return-early in RegisterWndClass()Patric Stout
2021-01-17Codechange: [Win32] Remove Windows 95 specific mouse tracking work-around.Michael Lutz
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
2021-01-03Revert 4ce53cb8: [OSX] Delayed fullscreen switch is not needed anymore.Michael Lutz
The fix for #8067 solves the real issue, making this workaround unneeded.
2021-01-03Fix #8067: [OSX] Calculate title bar height instead of assuming a fixed value.Michael Lutz
2021-01-03Fix: [OSX] Quitting in fullscreen mode would loose the original window size.Michael Lutz
This replicates the behaviour on e.g. Windows, which saves the original window size.
2021-01-03Change: [OSX] Hide Dock and menu during fullscreen mode.Michael Lutz
2021-01-03Codechange: [OSX] Silence some annoying warnings.Michael Lutz
2021-01-03Cleanup: [OSX] Remove cargo cult back-buffer alpha setting on show/hide and ↵Michael Lutz
instead simply initialise the buffer on allocation.
2021-01-03Change: [OSX] Compiling the Cocoa/Quartz video driver cannot be disabled ↵Michael Lutz
anymore.
2021-01-03Codechange: [OSX] Re-arrange the OSX video driver code by combining all ↵Michael Lutz
drawing code and moving the window/event handling to a different file. This is just a code move/rename, not a functionality change.
2020-12-27Codechange: Convert some more FIO functions to take std::string.Michael Lutz
2020-12-27Codechange: Use std::string in FIO search path handling.Michael Lutz
2020-12-27Codechange: Store file search paths as std::string.Michael Lutz
2020-12-27Codechange: Replace assert_compile macro with static_assertCharles Pigott
2020-12-21Doc: some comments for the win32 video driver (#8409)Patric Stout
Co-authored-by: Niels Martin Hansen <nielsm@indvikleren.dk>
2020-12-19Fix: [OSX] Warning about ambiguous method (-Wobjc-multiple-method-names). ↵Michael Lutz
(#8399)
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-09-25Codechange: Make codestyle for CMake files consistent for 'control' statementsCharles Pigott
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-07Cleanup: Correct typographic errors in code comments.TechGeekNZ
2020-06-05Add: introduce CMake for project managementPatric Stout
CMake works on all our supported platforms, like MSVC, Mingw, GCC, Clang, and many more. It allows for a single way of doing things, so no longer we need shell scripts and vbs scripts to work on all our supported platforms. Additionally, CMake allows to generate project files for like MSVC, KDevelop, etc. This heavily reduces the lines of code we need to support multiple platforms from a project perspective. Addtiionally, this heavily improves our detection of libraries, etc.
2020-06-04Codechange: Realign SDL driver with SDL2 driver to ease maintenance and ↵TechGeekNZ
emphasise differences.
2020-06-01Fix #8066: Try another fallback colourspace if first one failsNiels Martin Hansen
2020-05-21Codechange: Use std::string in the driver and blitter selection code.Michael Lutz