mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-02-17 03:15:39 +00:00
HostInterface: Move ModifyResolutionScale() to base class
This commit is contained in:
parent
8148486a9f
commit
40799d0f77
|
@ -559,6 +559,23 @@ void HostInterface::ToggleSoftwareRendering()
|
|||
m_system->RecreateGPU(new_renderer);
|
||||
}
|
||||
|
||||
void HostInterface::ModifyResolutionScale(s32 increment)
|
||||
{
|
||||
const u32 new_resolution_scale =
|
||||
std::clamp<u32>(static_cast<u32>(static_cast<s32>(m_settings.gpu_resolution_scale) + increment), 1,
|
||||
m_settings.max_gpu_resolution_scale);
|
||||
if (new_resolution_scale == m_settings.gpu_resolution_scale)
|
||||
return;
|
||||
|
||||
m_settings.gpu_resolution_scale = new_resolution_scale;
|
||||
if (m_system)
|
||||
m_system->GetGPU()->UpdateSettings();
|
||||
|
||||
AddFormattedOSDMessage(2.0f, "Resolution scale set to %ux (%ux%u)", m_settings.gpu_resolution_scale,
|
||||
GPU::VRAM_WIDTH * m_settings.gpu_resolution_scale,
|
||||
GPU::VRAM_HEIGHT * m_settings.gpu_resolution_scale);
|
||||
}
|
||||
|
||||
void HostInterface::RunFrame()
|
||||
{
|
||||
m_frame_timer.Reset();
|
||||
|
|
|
@ -111,6 +111,9 @@ protected:
|
|||
/// Quick switch between software and hardware rendering.
|
||||
void ToggleSoftwareRendering();
|
||||
|
||||
/// Adjusts the internal (render) resolution of the hardware backends.
|
||||
void ModifyResolutionScale(s32 increment);
|
||||
|
||||
void RunFrame();
|
||||
|
||||
/// Throttles the system, i.e. sleeps until it's time to execute the next frame.
|
||||
|
|
|
@ -426,9 +426,7 @@ void SDLHostInterface::HandleSDLKeyEvent(const SDL_Event* event)
|
|||
case SDL_SCANCODE_PAGEUP:
|
||||
case SDL_SCANCODE_PAGEDOWN: {
|
||||
if (pressed)
|
||||
{
|
||||
DoModifyInternalResolution(event->key.keysym.scancode == SDL_SCANCODE_PAGEUP ? 1 : -1);
|
||||
}
|
||||
ModifyResolutionScale(event->key.keysym.scancode == SDL_SCANCODE_PAGEUP ? 1 : -1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1555,23 +1553,6 @@ void SDLHostInterface::DoToggleFullscreen()
|
|||
UpdateFullscreen();
|
||||
}
|
||||
|
||||
void SDLHostInterface::DoModifyInternalResolution(s32 increment)
|
||||
{
|
||||
const u32 new_resolution_scale =
|
||||
std::clamp<u32>(static_cast<u32>(static_cast<s32>(m_settings.gpu_resolution_scale) + increment), 1,
|
||||
m_settings.max_gpu_resolution_scale);
|
||||
if (new_resolution_scale == m_settings.gpu_resolution_scale)
|
||||
return;
|
||||
|
||||
m_settings.gpu_resolution_scale = new_resolution_scale;
|
||||
if (m_system)
|
||||
m_system->GetGPU()->UpdateSettings();
|
||||
|
||||
AddFormattedOSDMessage(2.0f, "Resolution scale set to %ux (%ux%u)", m_settings.gpu_resolution_scale,
|
||||
GPU::VRAM_WIDTH * m_settings.gpu_resolution_scale,
|
||||
GPU::VRAM_HEIGHT * m_settings.gpu_resolution_scale);
|
||||
}
|
||||
|
||||
void SDLHostInterface::Run()
|
||||
{
|
||||
m_audio_stream->PauseOutput(false);
|
||||
|
|
|
@ -100,7 +100,6 @@ private:
|
|||
void DoTogglePause();
|
||||
void DoFrameStep();
|
||||
void DoToggleFullscreen();
|
||||
void DoModifyInternalResolution(s32 increment);
|
||||
|
||||
void HandleSDLEvent(const SDL_Event* event);
|
||||
void HandleSDLKeyEvent(const SDL_Event* event);
|
||||
|
|
Loading…
Reference in a new issue