summaryrefslogtreecommitdiff
path: root/src/video/sdl2_v.h
AgeCommit message (Collapse)Author
2021-02-20Fix ec1dd0bf: missing override causing compiler warnings (#8708)Patric Stout
2021-02-20Codechange: deduplicate tick-handlers of all video driversPatric Stout
They were all identical, so better put this in a single place hoping it is less likely to break.
2021-02-20Codechange: be consistent in what CheckPaletteAnim() does and when it is calledPatric Stout
Additionally, make sure this is a class method. Later commits will make use of this.
2021-02-20Codechange: be consistent in naming the paint function Paint()Patric Stout
Also move this function to be a class member. This to allow further deduplicating of code in a later commit.
2021-02-20Codechange: use (Un)LockVideoBuffer() to manage video bufferPatric Stout
2021-02-20Codechange: move all input-handling of video-drivers into InputLoopPatric Stout
2021-02-19Add: draw the screen at a steady pace, also during fast-forwardPatric Stout
During fast-forward, the game was drawing as fast as it could. This means that the fast-forward was limited also by how fast we could draw, something that people in general don't expect. To give an extreme case, if you are fully zoomed out on a busy map, fast-forward would be mostly limited because of the time it takes to draw the screen. By decoupling the draw-tick and game-tick, we can keep the pace of the draw-tick the same while speeding up the game-tick. To use the extreme case as example again, if you are fully zoomed out now, the screen only redraws 33.33 times per second, fast-forwarding or not. This means fast-forward is much more likely to go at the same speed, no matter what you are looking at.
2021-02-19Codechange: track _realtime_tick more accuratePatric Stout
_realtime_tick was reset every time the diff was calculated. This means if it would trigger, say, every N.9 milliseconds, it would after two iterations already drift a millisecond. This adds up pretty quick.
2021-02-19Codechange: switch all video drivers to std::chrono for keeping timePatric Stout
On all OSes we tested the std::chrono::steady_clock is of a high enough resolution to do millisecond measurements, which is all we need. By accident, this fixes a Win32 driver bug, where we would never hit our targets, as the resolution of the clock was too low to do accurate millisecond measurements with (it was ~16ms resolution instead).
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-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-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
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-05-21Codechange: Use std::string in the driver and blitter selection code.Michael Lutz
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-09-19Add #6173: New SDL 2 based video and sound drivers (#7086)nikolas