Commit Graph

153 Commits

Author SHA1 Message Date
Patric Stout
5bfa014505 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.
2021-02-19 10:43:15 +01:00
Patric Stout
25f6851ca1 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).
2021-02-19 10:43:15 +01:00
milek7
751f595bb6 Fix: VkMapping declarations violated C++ ODR rule. 2021-02-14 23:19:50 +01:00
Michael Lutz
f175e38666 Add: [Win32] Automatic zoom level suggestion for Win32 video driver.
The zoom level suggestion is based on the DPI scaling set in Windows.
We use 150% scaling as the threshold for 2X zoom and 300% scaling
as the threshold for 4X zoom.
2021-02-14 14:16:40 +01:00
Patric Stout
1eceee915e Codechange: [SDL2/Win32] Be consistent how 0bpp blitters are not allowed
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-17 19:57:36 +01:00
Patric Stout
49df9c4155 Codechange: [Win32] Use _local_palette for most operations
Other drivers do this too, and this makes the world a bit more
the same.
2021-01-17 19:57:36 +01:00
Patric Stout
881d17d8f1 Codechange: [Win32] use CSleep() instead of Sleep() like everywhere else
Functional it is identical. Just helps future-us when searching
for sleeps.
2021-01-17 19:57:36 +01:00
Patric Stout
689404a4a1 Codechange: [Win32] Use return-early in RegisterWndClass() 2021-01-17 19:57:36 +01:00
Michael Lutz
7415964a4d Codechange: [Win32] Remove Windows 95 specific mouse tracking work-around. 2021-01-17 19:57:36 +01:00
Michael Lutz
fa60c1f8b9
Feature: Choose a sensible window size on a fresh OTTD config file. (#8536) 2021-01-14 21:53:06 +01:00
Charles Pigott
9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Patric Stout
34051c10df
Doc: some comments for the win32 video driver (#8409)
Co-authored-by: Niels Martin Hansen <nielsm@indvikleren.dk>
2020-12-21 22:28:56 +01:00
Michael Lutz
37bc2f8064 Codechange: Use std::string in the driver and blitter selection code. 2020-05-21 20:02:34 +02:00
S. D. Cloudt
13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
glx
9195f2337a Codechange: use std::vector for _resolutions 2019-04-18 21:49:34 +02:00
Henry Wilson
7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Michael Lutz
967b27a2c1 Codechange: C++11 STL has a function for getting the number of CPU cores. 2019-04-06 11:27:39 +02:00
Michael Lutz
05bc2ed7cb Codechange: Replace custom thread code with C++11 thread objects.
We assume a conforming C++11 compiler environment that has a valid <thread>-header.
Failure to run a real thread is handled gracefully.
2019-04-06 11:27:39 +02:00
Michael Lutz
05f4e73608 Codechange: Replace custom mutex code with C++11 mutex'es.
A conforming compiler with a valid <mutex>-header is expected.
Most parts of the code assume that locking a mutex will never fail unexpectedly,
which is generally true on all common platforms that don't just pretend to
be C++11. The use of condition variables in driver code is checked.
2019-04-06 11:27:39 +02:00
Charles Pigott
fe8c24e081 Codechange: Remove unnecessarily defined functions under MinGW 2019-01-17 21:55:15 +00:00
Charles Pigott
2d981a4b2c Fix: A few minor compile warnings under MinGW 2019-01-17 21:55:15 +00:00
Niels Martin Hansen
2a868b9f3b Feature: Framerate display window (#6822)
Frame rate and various game loop/graphics timing measurements and graphs. Accessible via the Help menu, and can print some stats in the console via the fps command.
2018-07-19 21:17:07 +02:00
Michael Lutz
dbfc417e65 Fix: [Win32] Garbage in OS window title if branch name was too long.
This was caused by a missing \0-character on reaching the buffer limit.
2018-06-27 22:16:43 +02:00
Patric Stout
aef69443e7 Remove: WinCE support 2018-04-29 15:32:16 +02:00
Michael Lutz
4bfd277017 Codechange: [Win32] Use OS function for mouse tracking if present. 2018-04-10 21:07:27 +02:00
michi_cc
c722cb26b8 (svn r27935) -Fix [FS#6629]: [Win32] Right mouse scrolling didn't work properly with the Windows 10 Fall Creators Update. 2017-12-09 19:21:45 +00:00
frosch
b4b98e5165 (svn r27893) -Codechange: Use fallthrough attribute. (LordAro) 2017-08-13 18:38:42 +00:00
frosch
b1fe837b8e (svn r27775) -Fix [FS#6510]: Insufficient thread synchronisation when switching blitters. (JGR) 2017-03-11 13:05:54 +00:00
michi_cc
c83306391e (svn r27673) -Add: [Win32] Thread names for windows debuggers. 2016-10-30 18:22:55 +00:00
frosch
352e528cda (svn r27167) -Fix: [SDL, Windows] Right-mouse-button scrolling scrolled/jumped way to far, when OpenTTD lagged during mouse event processing. 2015-02-22 23:06:45 +00:00
planetmaker
3df230af62 (svn r26943) -Fix: [Win32] Silence a warning about comparison of signed and unsigned variables when using gcc 2014-09-30 21:10:32 +00:00
rubidium
b476086c39 (svn r26538) -Codechange: remove double accounting of the drivers 2014-04-28 21:06:51 +00:00
frosch
631e8b45fd (svn r26522) -Add: A config-file-only setting to disable usage of 8bpp video modes.
-Remove: [win32] fullscreen_bpp setting, which is replaced by above setting.
-Change: Disable usage of 8bpp blitters and video modes by default. Many modern OS and hardware cause issues with those.
2014-04-27 12:15:14 +00:00
rubidium
0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 2014-04-23 20:13:33 +00:00
michi_cc
e15446bc58 (svn r26367) -Fix: [Win32] Use a separate event to indicate that the drawing thread has finished initialising, preventing potential deadlocks. 2014-02-23 16:08:50 +00:00
fonsinchen
d8eda06a5a (svn r26366) -Fix: Protect the windows video driver from concurrent access (frosch123) 2014-02-23 14:16:36 +00:00
fonsinchen
b4a015a4bd (svn r26365) -Fix [FS#5867]: Don't draw the cursor when its sprite isn't ready and set _screen.dst_ptr immediately when the buffer changes (frosch123) 2014-02-23 14:15:55 +00:00
frosch
aaa6d0f9ae (svn r26360) -Revert (r25550) / Fix [FS#5922]: ClientSizeChanged is only called via WndProcGdi which already has the mutex. The issue which r25550 tried to fix still exists as FS#5867. 2014-02-22 14:26:07 +00:00
rubidium
a942619911 (svn r26247) -Fix [FS#5854, FS#5855]: Possible out of bounds reads with the sse blitters (MJP) 2014-01-13 17:54:24 +00:00
rubidium
fb05674cb7 (svn r26211) -Add: specialised non-animated SS2 blitter (MJP)
With 32bpp base set about 30% faster than 32bpp-optimized, or about 10% for 8bpp base sets in the Draw function. Respectively about 5 and 1% of total run time
2014-01-02 23:12:32 +00:00
rubidium
2618d960e3 (svn r26209) -Codechange: remove some template magic and simplify some code 2014-01-02 22:41:58 +00:00
rubidium
3b9f92e14c (svn r26009) -Fix: warning about conditional expression with enumeral with non-enumeral type 2013-11-16 10:05:57 +00:00
michi_cc
0883cf76e3 (svn r25684) -Change: [Win32] Draw the composition string ourselves if possible. 2013-08-05 20:37:25 +00:00
michi_cc
cbdfd31a3c (svn r25682) -Change: [Win32] Position the IME candidate window at the caret position. 2013-08-05 20:37:18 +00:00
michi_cc
da09fd3077 (svn r25681) -Change: [Win32] Position the IME composition window at the caret position. 2013-08-05 20:37:14 +00:00
michi_cc
21126aec62 (svn r25680) -Codechange: [Win32] Cancel the current IME composition when the input focus changes. 2013-08-05 20:37:11 +00:00
michi_cc
7422120014 (svn r25679) -Codechange: [Win32] Get the result string of an IME input directly without a trip through the window messaging system. 2013-08-05 20:37:06 +00:00
michi_cc
63332afcf0 (svn r25675) -Fix: [Win32] Handle DBCS characters correctly in the non-Unicode build. 2013-08-05 20:36:51 +00:00
michi_cc
e37968aadd (svn r25673) -Fix: [Win32] Use the right code page for converting ANSI strings into UTF-8 for non-Unicode builds. And don't crap out on DBCS code pages either. 2013-08-05 20:36:43 +00:00
michi_cc
fdc436b531 (svn r25672) -Fix: [Win32] Handle Unicode characters from outside the BMP correctly. 2013-08-05 20:36:40 +00:00