|
Patric Stout
|
r28750:2657250b24e9
|
6 months ago
|
|
|
|
Rubidium
|
r26728:d50c0d7b11c7
|
20 months ago
|
|
Fix: virtual call from constructor
That fills an instance variable that is only read from the Game Options window and that is overwritten when the video driver is started. Since you cannot get into the Game Options window without starting the video driver, it is just pointless and wrong code that would never be noticed by the end user.
|
|
Niels Martin Hansen
|
r26238:1e3d0e5795b7
|
2 years ago
|
|
|
|
Patric Stout
|
r25724:cf37407a0fa2
|
3 years ago
|
|
Codechange: use _cur_palette the same in all the drivers
It was a bit of a mixed bag. With this change, gfx.cpp is in control who accesses _cur_palette from the video-drivers.
|
|
Rubidium
|
r25173:d0e76c872f58
|
3 years ago
|
|
|
|
sean
|
r25019:7bd7e70574c6
|
3 years ago
|
|
|
|
Patric Stout
|
r25011:61d28a13bb41
|
3 years ago
|
|
Remove: [Video] no longer draw in a thread
Drawing in a thread is a bit odd, and often leads to surprising issues. For example, OpenGL would only allow it if you move the full context to the thread. Which is not always easily done on all OSes. In general, the advise is to handle system events and drawing from the main thread, and do everything else in other threads. So, let's be more like other games.
Additionally, putting the drawing routine in a thread was only done for a few targets.
Upcoming commit will move the GameLoop in a thread, which will work for all targets.
|
|
Patric Stout
|
r24939:f00f6879a003
|
3 years ago
|
|
Codechange: [Video] make the prototype of PollEvent() the same for all drivers
Additionally, call it from the draw-tick.
|
|
Michael Lutz
|
r24918:e55bb9103b0b
|
4 years ago
|
|
|
|
Michael Lutz
|
r24916:2d0cdad1b8b0
|
3 years ago
|
|
|
|
Patric Stout
|
r24915:5a3c224c2b5a
|
4 years ago
|
|
Codechange: [SDL2] Allow several places to hook into the SDL driver
This allows future subdrivers to use these to manage their own flow.
|
|
Patric Stout
|
r24914:bf493787c2f9
|
4 years ago
|
|
Codechange: [SDL2] Move functions and variables to class-scope
This allows future subdrivers to override them.
|
|
Patric Stout
|
r24913:8df991aa7a76
|
4 years ago
|
|
Codechange: [SDL2] Move SDLSurface code to its own function
This increases readability, and allow future subdrivers to not use SDLSurface to draw.
|
|
Patric Stout
|
r24912:d785e8bae96e
|
4 years ago
|
|
Codechange: [SDL2] Split Start() in a few more functions
This makes it a bit easier to follow what is going on, and allow future subdrivers to hook into a few of these functions.
Reworked the code slighly while at it, to return early where possible.
|
|
Patric Stout
|
r24863:8e8149a87eef
|
3 years ago
|
|
|
|
Patric Stout
|
r24855:196c88971d0d
|
3 years ago
|
|
Codechange: deduplicate tick-handlers of all video drivers
They were all identical, so better put this in a single place hoping it is less likely to break.
|
|
Patric Stout
|
r24852:00c1bd78d033
|
3 years ago
|
|
Codechange: be consistent in what CheckPaletteAnim() does and when it is called
Additionally, make sure this is a class method. Later commits will make use of this.
|
|
Patric Stout
|
r24851:a41e925d9dc7
|
3 years ago
|
|
Codechange: be consistent in naming the paint function Paint()
Also move this function to be a class member. This to allow further deduplicating of code in a later commit.
|
|
Patric Stout
|
r24850:df6b081a960b
|
3 years ago
|
|
|
|
Patric Stout
|
r24849:01243a72f255
|
3 years ago
|
|
|
|
Patric Stout
|
r24833:e40e0f8b2230
|
3 years ago
|
|
Add: draw the screen at a steady pace, also during fast-forward
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.
|
|
Patric Stout
|
r24832:f2376ca1bbb7
|
3 years ago
|
|
Codechange: track _realtime_tick more accurate
_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.
|
|
Patric Stout
|
r24831:5af48bd7a880
|
3 years ago
|
|
Codechange: switch all video drivers to std::chrono for keeping time
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).
|
|
Patric Stout
|
r24714:bb51e0c11c9b
|
4 years ago
|
|
Codechange: [SDL2] Rework how palette is updated
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.
|
|
Patric Stout
|
r24712:655f7e7d3209
|
4 years ago
|
|
Codechange: [SDL2] Split away CreateMainWindow from CreateMainSurface
This makes the code a bit more readable, as both intentions are more clear, and there is less nesting in the main function.
|
|
frosch
|
r24666:516313d51875
|
4 years ago
|
|
|
|
Michael Lutz
|
r24665:20a8caea4459
|
4 years ago
|
|
|
|
Patric Stout
|
r24439:3207de2680bf
|
4 years ago
|
|
Add: support for emscripten (play-OpenTTD-in-the-browser)
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>
|
|
Patric Stout
|
r24438:b17f2f305eee
|
4 years ago
|
|
Codechange: unroll the SDL2 main loop
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.
|
|
Michael Lutz
|
r24218:c32caa9f014d
|
4 years ago
|
|
|
|
S. D. Cloudt
|
r23917:50c2317ea357
|
5 years ago
|
|
|
|
Jonathan G Rennison
|
r23916:5686b9962962
|
5 years ago
|
|
Fix #7783, Fix #7816: [SDL2] Fix input handling in edit context In particular this fixes handling of the shift key
|
|
nikolas
|
r23833:61ad963f9e87
|
5 years ago
|
|
|