Commit Graph

72 Commits

Author SHA1 Message Date
Peter Nelson 332cbca36e Codechange: Pass std::string_view from drivers instead of char *. 2024-04-10 22:02:04 +01:00
Patric Stout bad31f2d42
Fix #10079: don't render at 1000fps if HW acceleration + vsync is requested but not active (#12067) 2024-02-12 21:39:23 +00:00
Rubidium e3f49ee7a0 Codechange: coding style fixes 2024-01-04 16:23:54 +01: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
Michael Lutz b351cbe490 Fix #9743: [OSX] Only (re-)create touchbar sprites when requested by the main loop. 2022-01-01 12:19:30 +01:00
sean 0464a50ab8
Add: Display refresh rate game option (#8813) 2021-03-09 10:22:52 +01:00
Patric Stout b93d7dd3cb
Add: Option to (dis-)allow accelerated video drivers. (#8819)
The video drivers using the OpenGL backend are currently our only
accelerated drivers. The options defaults to off for macOS builds and
to on everywhere else.

Co-authored-by: Michael Lutz <michi@icosahedron.de>
2021-03-08 15:42:39 +01:00
Patric Stout 6a8c461e38 Codechange: [OSX] GameLoop is really more like MainLoop
MainLoop() is used to bootstrap OSX, where later a callback is
done to GameLoop() to execute OpenTTD. All other video drivers
don't need that, so what is in GameLoop is in MainLoop for all
other drivers. This is rather confusing. So, instead, name
GameLoop MainLoopReal to be more in sync with the other drivers.
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
Michael Lutz 7f55f0a264 Codechange: [OSX] Add support for (un)locking the video buffer. 2021-02-22 22:16:07 +01:00
Michael Lutz 2f25e9bdf8 Codechange: [OSX] Separate video driver into a base and a Quartz implementation. 2021-02-22 22:16:07 +01:00
Michael Lutz f3c192c63d Codechange: [OSX] Only keep a total dirty rect for drawing.
When drawing an 8bpp screen buffer, palette resolving was done for each
dirty rectangle. In areas with high activity, this would mean a pixel might
have been resolved multiple times. Also, if too many individual updates
were queued, the whole screen would be refreshed, even if unnecessary.

All other drivers only keep one overall dirty rect, so do it here as well.
2021-02-20 21:14:44 +01:00
Patric Stout ec1dd0bf61 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.
2021-02-20 17:08:44 +01:00
Patric Stout 790fa7102e 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.
2021-02-20 17:08:44 +01:00
Patric Stout 661eb39ecc Codechange: move all input-handling of video-drivers into InputLoop 2021-02-20 17:08:44 +01:00
Michael Lutz 8d780e0607 Add: [OSX] Automatic zoom level suggestion for Cocoa video driver. 2021-02-14 14:16:40 +01:00
Michael Lutz acca56b6a5 Cleanup: [OSX] Improve some comments. 2021-02-13 22:21:17 +01:00
Michael Lutz c78e559e88 Codechange: [OSX] Remove unused 'app active' flag. 2021-02-13 22:21:17 +01:00
Michael Lutz 94b76ce9a4 Cleanup: [OSX] Move event loop into video driver file. 2021-02-13 22:21:17 +01:00
Michael Lutz f4bd54fedd Codechange: [OSX] Move mouse event handling to our NSView. 2021-02-13 22:21:17 +01:00
Michael Lutz bd42fc94cc Codechange: [OSX] Move some things from video driver to our NSView. 2021-02-13 22:21:17 +01:00
Michael Lutz 8aaf4ea098 Codechange: [OSX] Split Window and back buffer creation in Cocoa video driver. 2021-02-13 22:21:17 +01:00
Michael Lutz 0eff7de659 Cleanup: [OSX] Doxygen comment style in video driver. 2021-02-13 22:21:17 +01:00
Michael Lutz 8ced72ab10 Codechange: [OSX] Inline some functions that are used in only one place. 2021-02-13 22:21:17 +01:00
Michael Lutz 13134f9d64 Codechange: [OSX] Replace #define with modern code. 2021-02-13 22:21:17 +01:00
Michael Lutz 88f6c7a9f3 Codechange: [OSX] Fold remaining Cocoa video subdriver into the main driver. 2021-02-13 22:21:17 +01:00
Michael Lutz e6bea3961f Change: [OSX] Replace screen resolution list with suggested window sizes.
We never change the real screen resolution on OSX. As such, offering a list
of resolutions is pointless. Instead of that, offer the user a list of
commonly used window sizes up to the current screen size.
2021-02-13 22:21:17 +01:00
Michael Lutz 4db7837d06 Codechange: [OSX] There is only one subdriver left, remove virtual dispatch. 2021-02-13 22:21:17 +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
Michael Lutz 979b4af6ca Revert 4ce53cb8: [OSX] Delayed fullscreen switch is not needed anymore.
The fix for #8067 solves the real issue, making this workaround unneeded.
2021-01-03 22:24:04 +01:00
Michael Lutz 4ce53cb851 Fix: [OSX] Quitting in fullscreen mode would loose the original window size.
This replicates the behaviour on e.g. Windows, which saves the original window size.
2021-01-03 21:20:28 +01:00
Michael Lutz c860a247d3 Change: [OSX] Hide Dock and menu during fullscreen mode. 2021-01-03 21:20:28 +01:00
Michael Lutz 7bdaabf5f1 Cleanup: [OSX] Remove cargo cult back-buffer alpha setting on show/hide and instead simply initialise the buffer on allocation. 2021-01-03 13:25:32 +01:00
Michael Lutz a61a741683 Change: [OSX] Compiling the Cocoa/Quartz video driver cannot be disabled anymore. 2021-01-03 13:25:32 +01:00
Michael Lutz 9ccef816f9 Codechange: [OSX] Re-arrange the OSX video driver code by combining all drawing code and moving the window/event handling to a different file.
This is just a code move/rename, not a functionality change.
2021-01-03 13:25:32 +01:00
Michael Lutz 37bc2f8064 Codechange: Use std::string in the driver and blitter selection code. 2020-05-21 20:02:34 +02:00
Michael Lutz 9dd8b3d430 Remove: [OSX] Stuff that is pre-10.7 from the Cocoa/Quartz video driver. 2020-04-12 18:44:43 +02:00
Michael Lutz 0e5be3887c Remove: [OSX] Old fullscreen subdriver for pre 10.7 systems.
Since the move to C++11, building for pre 10.7 is not possible with the native
Apple tools. Also, due to bitrot, the file doesn't even compile anymore. While
this could be fixed, it shows that this subdriver is basically never used anymore.
2020-04-12 18:44:43 +02:00
Michael Lutz a31cbbf67f Remove: [OSX] QuickDraw video subdriver used for OSX versions up to 10.4.
Since the C++11 move, getting OpenTTD to compile and run for anything
below 10.7 basically requires building a custom compiler and libc++.
Also, the QuickDraw subdriver crashes on more modern OSX version. While this
is fixable, keeping the driver around is probably pointless.
2020-04-12 18:44:43 +02:00
Sebastian Pauka bd3a5876b0 Fix #7644: [Cocoa] Manually set colorspace to sRGB 2020-03-30 08:25:14 +02:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Michael Lutz ed6a427fcc Change: [OSX] Recreate backing store if the colour profile of the screen (or the screen) the game window is one changes.
This will result in changing colours if moving OpenTTD from one screen to another, but should avoid performance problems if the window is moved.
2019-09-16 19:11:08 +01:00
Henry Wilson af7d9020a1 Codechange: Use override specifer for overriding member declarations
This is a C++11 feature that allows the compiler to check that a virtual
member declaration overrides a base-class member with the same signature.

Also src/blitter/32bpp_anim_sse4.hpp +38 is no longer erroneously marked
as virtual despite being a template.
2019-03-24 16:10:04 +01:00
Michael Lutz 74b7f0a9aa Fix: [OSX] Remove some OSX compiler warnings on newer SDKs/compilers. 2018-04-10 23:30:01 +02:00
rubidium defda16eb6 (svn r26108) -Codechange: some coding style (whitespace) 2013-11-25 14:30:22 +00:00
rubidium 6996b441d9 (svn r26107) -Codechange/cleanup: remove some coding bloat and simplify the driver factory instatiations 2013-11-25 14:26:46 +00:00
michi_cc b3ecfbb67a (svn r25693) -Add: [OSX] Support the new IME functions introduced with 10.5. 2013-08-05 20:38:02 +00:00
michi_cc c64e297e0c (svn r25688) -Codechange: [OSX] Make our view aware of text input by IMEs. 2013-08-05 20:37:40 +00:00
michi_cc e4d48f3a3b (svn r25686) -Codechange: [OSX] Abandon IME input if the edit box lost the focus. 2013-08-05 20:37:33 +00:00
michi_cc 6d50b10074 (svn r25655) -Fix: [OSX] Mouse cursor wasn't displayed properly after switching to fullscreen on 10.7+. (Based on patch by Maedhros) 2013-08-05 20:35:38 +00:00