Merge tag '1.11.0-beta2' into master
This commit is contained in:
45
src/gfx.cpp
45
src/gfx.cpp
@@ -35,8 +35,7 @@ CursorVars _cursor;
|
||||
bool _ctrl_pressed; ///< Is Ctrl pressed?
|
||||
bool _shift_pressed; ///< Is Shift pressed?
|
||||
bool _move_pressed;
|
||||
|
||||
byte _fast_forward;
|
||||
uint16 _game_speed = 100; ///< Current game-speed; 100 is 1x, 0 is infinite.
|
||||
bool _left_button_down; ///< Is left mouse button pressed?
|
||||
bool _left_button_clicked; ///< Is left mouse button clicked?
|
||||
bool _right_button_down; ///< Is right mouse button pressed?
|
||||
@@ -64,6 +63,10 @@ static ReusableBuffer<uint8> _cursor_backup;
|
||||
ZoomLevel _gui_zoom; ///< GUI Zoom level
|
||||
ZoomLevel _font_zoom; ///< Font Zoom level
|
||||
|
||||
int8 _gui_zoom_cfg; ///< GUI zoom level in config.
|
||||
int8 _font_zoom_cfg; ///< Font zoom level in config.
|
||||
|
||||
|
||||
/**
|
||||
* The rect for repaint.
|
||||
*
|
||||
@@ -1395,6 +1398,9 @@ void ScreenSizeChanged()
|
||||
|
||||
void UndrawMouseCursor()
|
||||
{
|
||||
/* Don't undraw mouse cursor if it is handled by the video driver. */
|
||||
if (VideoDriver::GetInstance()->UseSystemCursor()) return;
|
||||
|
||||
/* Don't undraw the mouse cursor if the screen is not ready */
|
||||
if (_screen.dst_ptr == nullptr) return;
|
||||
|
||||
@@ -1408,6 +1414,9 @@ void UndrawMouseCursor()
|
||||
|
||||
void DrawMouseCursor()
|
||||
{
|
||||
/* Don't draw mouse cursor if it is handled by the video driver. */
|
||||
if (VideoDriver::GetInstance()->UseSystemCursor()) return;
|
||||
|
||||
/* Don't draw the mouse cursor if the screen is not ready */
|
||||
if (_screen.dst_ptr == nullptr) return;
|
||||
|
||||
@@ -1517,9 +1526,8 @@ void DrawDirtyBlocks()
|
||||
_modal_progress_paint_mutex.unlock();
|
||||
_modal_progress_work_mutex.unlock();
|
||||
|
||||
/* Wait a while and update _realtime_tick so we are given the rights */
|
||||
/* Wait a while and hope the modal gives us a bit of time to draw the GUI. */
|
||||
if (!IsFirstModalProgressLoop()) CSleep(MODAL_PROGRESS_REDRAW_TIMEOUT);
|
||||
_realtime_tick += MODAL_PROGRESS_REDRAW_TIMEOUT;
|
||||
|
||||
/* Modal progress thread may need blitter access while we are waiting for it. */
|
||||
VideoDriver::GetInstance()->ReleaseBlitterLock();
|
||||
@@ -1927,3 +1935,32 @@ void SortResolutions()
|
||||
{
|
||||
std::sort(_resolutions.begin(), _resolutions.end());
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve GUI zoom level, if auto-suggestion is requested.
|
||||
*/
|
||||
void UpdateGUIZoom()
|
||||
{
|
||||
/* Determine real GUI zoom to use. */
|
||||
if (_gui_zoom_cfg == ZOOM_LVL_CFG_AUTO) {
|
||||
_gui_zoom = static_cast<ZoomLevel>(Clamp(VideoDriver::GetInstance()->GetSuggestedUIZoom(), _settings_client.gui.zoom_min, _settings_client.gui.zoom_max));
|
||||
} else {
|
||||
_gui_zoom = static_cast<ZoomLevel>(_gui_zoom_cfg);
|
||||
}
|
||||
|
||||
/* Determine real font zoom to use. */
|
||||
if (_font_zoom_cfg == ZOOM_LVL_CFG_AUTO) {
|
||||
_font_zoom = static_cast<ZoomLevel>(VideoDriver::GetInstance()->GetSuggestedUIZoom());
|
||||
} else {
|
||||
_font_zoom = static_cast<ZoomLevel>(_font_zoom_cfg);
|
||||
}
|
||||
}
|
||||
|
||||
void ChangeGameSpeed(bool enable_fast_forward)
|
||||
{
|
||||
if (enable_fast_forward) {
|
||||
_game_speed = _settings_client.gui.fast_forward_speed_limit;
|
||||
} else {
|
||||
_game_speed = 100;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user