Commit Graph

232 Commits

Author SHA1 Message Date
Patric Stout d3ee045c2d
Codechange: refactor the Windows-only DllLoader in a cross-platform LibraryLoader (#11751) 2024-01-10 21:38:58 +00:00
Rubidium 2072e532f7 Codechange: replace NULL with nullptr 2023-12-26 07:18:52 +01:00
Patric Stout b866e52b17
Remove: officially mark Vista as no longer supported (#11531)
It is very likely Vista hasn't been working for years, but the
amount of users that use an OS that has been EoL for over 11 years
is very small, so reports happen rarely.
2023-12-02 22:12:50 +00:00
frosch 5733145c59 Cleanup: Remove unneeded parameters. 2023-09-19 22:49:59 +02:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
Patric Stout 6869f387ba
Fix 07add7a9: [Win32] use full monitor resolution for fullscreen (#10985)
On Windows in fullscreen you cannot reach the top with
the cursor for the halve of the height of your toolbar.

Additionally, on Win10 in fullscreen you can see the actual toolbar.
2023-06-11 12:00:02 +02:00
Rubidium d5c0d3beb7 Codechange: unify the formatting of the game's caption 2023-06-07 08:02:46 +02:00
Patric Stout 07add7a96e
Fix: [Win32] position window in center of workspace of primary display (#10942) 2023-06-04 18:38:16 +00:00
Patric Stout 0d840b4570 Codechange: remove queue_wrap / last_position from mouse movement
No backend uses it anymore, so also no longer any need to support
it.
2023-06-04 00:40:56 +02:00
Rubidium f74e26ca7e Codechange: replace error/usererror printf variant with fmt variant and rename 2023-04-25 17:55:09 +02:00
Charles Pigott b282664242 Codechange: Replace all usages of alloca/AllocaM with more modern/less discouraged alternatives 2023-04-15 16:57:00 +01:00
Henry Wilson 0b2567d882 Codechange: Remove shift as fast-forward key when _DEBUG is defined 2023-01-26 22:15:06 +01:00
Peter Nelson 9666e46739 Feature: Variable GUI scale.
GUI scale is now variable from 100% to 500%, and no longer restricted to
powers-of-2.
2022-11-12 18:28:39 +00:00
Bouke Haarsma 45d98f689a Fix #9993: Handle DPI changes on macOS and Windows 2022-10-16 16:52:14 +02:00
Niels Martin Hansen 345dcd3c7b Add: Show current video driver info in Options window 2022-05-03 21:03:30 +02:00
Patric Stout 74186998a2 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.
2021-06-26 20:28:05 +02:00
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
glx22 d485b50813 Fix: [MinGW] Ignore wglGetProcAddress() cast warnings 2021-06-10 23:17:29 +02:00
glx22 744a9e4745 Codechange: [WIN32] Add a wrapper around GetProcAddress() 2021-06-10 23:17:29 +02:00
glx22 2df48a78cc Fix: [MinGW32] Can't convert lambda to stdcall 2021-06-10 23:17:29 +02:00
glx22 f4c7d5577e Codechange: [WIN32] Use VersionHelpers where appropriate 2021-06-10 23:17:29 +02:00
Michael Lutz f4d5c8d99e
Fix: [OpenGL] Main loop expects to start with the video buffer unmapped. (#9100) 2021-04-25 00:43:38 +02:00
Michael Lutz ef80baf75c Codechange: [Win32] Try getting an OpenGL 4.5 context first before aiming at 3.2. 2021-04-22 21:04:04 +02:00
Michael Lutz e53313391a Fix: [OpenGL] Check maximum supported texture size against screen resolution. 2021-04-21 22:44:59 +02:00
Michael Lutz 5644c00482
Fix: Check for a validly mapped OpenGL screen buffer during driver init. (#9007) 2021-04-11 14:28:29 +02:00
Patric Stout f0f2073006 Feature: allow a toggle to enable/disable vsync
Vsync should be off by default, as for most players it will be
better to play without vsync. Exception exist, mainly people who
play in fullscreen mode.
2021-04-11 14:26:00 +02:00
Jonathan G Rennison 39b7ef31f8 Fix: Data races on cursor state in OpenGL backends 2021-04-10 18:31:42 +02:00
Michael Lutz 96d33ab46a Fix #8930: [Win32] Don't handle printable keys on keydown if an edit box is in focus.
Handle printable input only when the matching WM_CHAR message is incoming.
Without an edit box, do the handling in keydown as usual to support hotkeys.
2021-04-09 12:24:27 +02:00
Niels Martin Hansen e0561dbded Fix #8713: Change OTTD2FS and FS2OTTD to return string objects instead of static buffers 2021-04-07 09:31:47 +02:00
Michael Lutz f0f96e3103
Fix #8871: [OpenGL] Initialize all buffers after resize and clear back buffer. (#8877) 2021-03-20 19:43:54 +01:00
sean 0464a50ab8
Add: Display refresh rate game option (#8813) 2021-03-09 10:22:52 +01:00
Patric Stout e56d2c63c3 Add: [Video] move GameLoop into its own thread
This allows drawing to happen while the GameLoop is doing an
iteration too.

Sadly, not much drawing currently can be done while the GameLoop
is running, as for example PollEvent() or UpdateWindows() can
influence the game-state. As such, they first need to acquire a
lock on the game-state before they can be called.

Currently, the main advantage is the time spend in Paint(), which
for non-OpenGL drivers can be a few milliseconds. For OpenGL this
is more like 0.05 milliseconds; in these instances this change
doesn't add any benefits for now.

This is an alternative to the former "draw-thread", which moved
the drawing in a thread for some OSes. It has similar performance
gain as this does, although this implementation allows for more
finer control over what suffers when the GameLoop takes too
long: drawing or the next GameLoop. For now they both suffer
equally.
2021-03-08 19:18:55 +01:00
Michael Lutz 3a4a15cc93 Codechange: don't set the window position when changing blitter
There really is no need to make an extra call to the OS in
these cases.
2021-03-08 19:18:55 +01:00
Patric Stout 4610aa7ae3 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.
2021-03-08 19:18:55 +01:00
Patric Stout 04db99749b
Fix #8784: using alt+enter didn't update the fullscreen toggle visibly (#8820)
Basically, the window was not invalidated, so it was never redrawn.
This made it look like it wasn't working, but it really was.
2021-03-08 16:57:59 +01:00
Michael Lutz c656633bea Fix #8775: [Win32] Don't create the main window when alt-tabbing back into fullscreen. 2021-03-01 23:41:39 +01:00
Michael Lutz b7a44983b4 Fix: [Win32] Original window size was lost when tabbing in and out of fullscreen. 2021-03-01 23:41:39 +01:00
Patric Stout c3dc27e37e Add: settings to limit your fast-forward game speed
By default this setting is set to 2500% normal game speed.
2021-02-28 18:04:51 +00:00
Michael Lutz 311df31fb1 Codechange: [OpenGL] Load all OpenGL functions dynamically. 2021-02-25 00:34:49 +01:00
Patric Stout 67d3c6aa71 Codechange: [Video] move InteractiveRandom() to the VideoDriver 2021-02-24 21:58:47 +01:00
Patric Stout c409f45ddd Codechange: [Video] make the prototype of PollEvent() the same for all drivers
Additionally, call it from the draw-tick.
2021-02-24 21:58:47 +01:00
Niels Martin Hansen b427ddce88 Codechange: Switch to explicit wide strings 2021-02-23 11:25:39 +01:00
Niels Martin Hansen beeb9e0a1b Remove: [Win32] Last pretenses of being able to build for Windows 95 2021-02-23 11:25:39 +01:00
Michael Lutz 06ca147a82 Fix 8706c36f: Change RELEASE code, too. 2021-02-22 23:16:46 +01:00
Michael Lutz 200be7d20c Add: [OpenGL] Support for a separate animation buffer that stores the palette values of the screen in addition to the colour buffer. 2021-02-22 22:16:07 +01:00
Michael Lutz 6bcc4884c2 Add: [OpenGL] Accelerated mouse cursor drawing. 2021-02-22 22:16:07 +01:00
Michael Lutz f94b2e73e1 Codechange: [Win32] Use an OpenGL core context instead of a compatibility one. 2021-02-22 22:16:07 +01:00
Michael Lutz e8fc050b6e Add: [OpenGL] Support for 8bpp blitters. 2021-02-22 22:16:07 +01:00
Michael Lutz b181859629 Change: [Win32] Disable VSync for OpenGL by default. 2021-02-22 22:16:07 +01:00