Merge branch 'master' into jgrpp

# Conflicts:
#	regression/regression/result.txt
#	src/autoreplace_cmd.cpp
#	src/industry_gui.cpp
#	src/landscape.cpp
#	src/network/network_content.cpp
#	src/newgrf_roadstop.cpp
#	src/pathfinder/yapf/yapf_ship.cpp
#	src/road_gui.cpp
#	src/saveload/ai_sl.cpp
#	src/saveload/saveload.h
#	src/saveload/vehicle_sl.cpp
#	src/station.cpp
#	src/station_gui.cpp
#	src/video/cocoa/cocoa_ogl.h
#	src/video/sdl2_opengl_v.h
#	src/video/video_driver.hpp
#	src/video/win32_v.h
#	src/widget_type.h
#	src/widgets/dropdown.cpp
#	src/widgets/dropdown_type.h
#	src/window.cpp
This commit is contained in:
Jonathan G Rennison
2024-02-19 18:50:33 +00:00
119 changed files with 4346 additions and 2129 deletions

View File

@@ -22,7 +22,7 @@ class VideoDriver_CocoaOpenGL : public VideoDriver_Cocoa {
const char *AllocateContext(bool allow_software);
public:
VideoDriver_CocoaOpenGL() : gl_context(nullptr), driver_info(this->GetName()) {}
VideoDriver_CocoaOpenGL() : VideoDriver_Cocoa(true), gl_context(nullptr), driver_info(this->GetName()) {}
const char *Start(const StringList &param) override;
void Stop() override;

View File

@@ -35,7 +35,7 @@ public:
OTTD_CocoaWindowDelegate *delegate; //!< Window delegate object
public:
VideoDriver_Cocoa();
VideoDriver_Cocoa(bool uses_hardware_acceleration = false);
void Stop() override;
void MainLoop() override;

View File

@@ -86,7 +86,8 @@ static const Dimension _default_resolutions[] = {
};
VideoDriver_Cocoa::VideoDriver_Cocoa()
VideoDriver_Cocoa::VideoDriver_Cocoa(bool uses_hardware_acceleration)
: VideoDriver(uses_hardware_acceleration)
{
this->setup = false;
this->buffer_locked = false;

View File

@@ -12,7 +12,7 @@
/** The OpenGL video driver for windows. */
class VideoDriver_SDL_OpenGL : public VideoDriver_SDL_Base {
public:
VideoDriver_SDL_OpenGL() : gl_context(nullptr) {}
VideoDriver_SDL_OpenGL() : VideoDriver_SDL_Base(true), gl_context(nullptr) {}
const char *Start(const StringList &param) override;

View File

@@ -18,7 +18,7 @@
/** The SDL video driver. */
class VideoDriver_SDL_Base : public VideoDriver {
public:
VideoDriver_SDL_Base() : sdl_window(nullptr), buffer_locked(false) {}
VideoDriver_SDL_Base(bool uses_hardware_acceleration = false) : VideoDriver(uses_hardware_acceleration), sdl_window(nullptr), buffer_locked(false) {}
const char *Start(const StringList &param) override;

View File

@@ -22,8 +22,8 @@
#include "../window_func.h"
#include "video_driver.hpp"
bool _video_hw_accel; ///< Whether to consider hardware accelerated video drivers.
bool _video_vsync; ///< Whether we should use vsync (only if _video_hw_accel is enabled).
bool _video_hw_accel; ///< Whether to consider hardware accelerated video drivers on startup.
bool _video_vsync; ///< Whether we should use vsync (only if active video driver supports HW acceleration).
void VideoDriver::GameLoop()
{

View File

@@ -37,7 +37,7 @@ class VideoDriver : public Driver {
const uint DEFAULT_WINDOW_HEIGHT = 480u; ///< Default window height.
public:
VideoDriver() : fast_forward_key_pressed(false), fast_forward_via_key(false), is_game_threaded(true) {}
VideoDriver(bool uses_hardware_acceleration = false) : fast_forward_key_pressed(false), fast_forward_via_key(false), is_game_threaded(true), uses_hardware_acceleration(uses_hardware_acceleration) {}
/**
* Mark a particular area dirty.
@@ -328,7 +328,7 @@ protected:
std::chrono::steady_clock::duration GetDrawInterval()
{
/* If vsync, draw interval is decided by the display driver */
if (_video_vsync && _video_hw_accel) return std::chrono::microseconds(0);
if (_video_vsync && this->uses_hardware_acceleration) return std::chrono::microseconds(0);
return std::chrono::microseconds(1000000 / _settings_client.gui.refresh_rate);
}
@@ -361,6 +361,8 @@ protected:
std::recursive_mutex game_state_mutex;
std::mutex game_thread_wait_mutex;
bool uses_hardware_acceleration;
uint8_t *anim_buffer = nullptr; ///< Animation buffer, (not used by all drivers, here because it is accessed very frequently)
static void GameThreadThunk(VideoDriver *drv);

View File

@@ -19,7 +19,7 @@
/** Base class for Windows video drivers. */
class VideoDriver_Win32Base : public VideoDriver {
public:
VideoDriver_Win32Base() : main_wnd(nullptr), fullscreen(false), buffer_locked(false) {}
VideoDriver_Win32Base(bool uses_hardware_acceleration = false) : VideoDriver(uses_hardware_acceleration), main_wnd(nullptr), fullscreen(false), buffer_locked(false) {}
void Stop() override;
@@ -119,7 +119,7 @@ public:
/** The OpenGL video driver for windows. */
class VideoDriver_Win32OpenGL : public VideoDriver_Win32Base {
public:
VideoDriver_Win32OpenGL() : dc(nullptr), gl_rc(nullptr), driver_info(this->GetName()) {}
VideoDriver_Win32OpenGL() : VideoDriver_Win32Base(true), dc(nullptr), gl_rc(nullptr), driver_info(this->GetName()) {}
const char *Start(const StringList &param) override;