Skip to content
Permalink
Browse files

UWP Window resizing support

this correctly resize the render view when the Window is resized
  • Loading branch information...
driver1998 committed May 13, 2019
1 parent 2da9de9 commit 0e9f53c8b42917603e433098e6d985644b9c2cf2
Showing with 18 additions and 3 deletions.
  1. +1 −1 Core/Core.cpp
  2. +17 −2 UWP/App.cpp
@@ -150,7 +150,7 @@ static bool IsWindowSmall(int pixelWidth, int pixelHeight) {
// TODO: Feels like this belongs elsewhere.
bool UpdateScreenScale(int width, int height) {
bool smallWindow;
#ifdef _WIN32
#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP)
g_dpi = (float)System_GetPropertyInt(SYSPROP_DISPLAY_DPI);
g_dpi_scale_x = 96.0f / g_dpi;
g_dpi_scale_y = 96.0f / g_dpi;
@@ -6,6 +6,9 @@
#include <mutex>

#include "input/input_state.h"
#include "base/NativeApp.h"
#include "Core/System.h"
#include "Core/Core.h"

#include <ppltasks.h>

@@ -149,7 +152,7 @@ void App::OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::C
int64_t timestamp = args->CurrentPoint->Timestamp;
m_main->OnTouchEvent(TOUCH_DOWN|TOUCH_MOVE, pointerId, X, Y, timestamp);
#if !PPSSPP_ARCH(ARM)
sender->SetPointerCapture();
sender->SetPointerCapture();
#endif
}

@@ -237,8 +240,20 @@ void App::OnResuming(Platform::Object^ sender, Platform::Object^ args) {
// Window event handlers.

void App::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) {
m_deviceResources->SetLogicalSize(Size(sender->Bounds.Width, sender->Bounds.Height));
int width = sender->Bounds.Width;
int height = sender->Bounds.Height;
float scale = m_deviceResources->GetDpi() / 96.0f;

m_deviceResources->SetLogicalSize(Size(width, height));
m_main->CreateWindowSizeDependentResources();

PSP_CoreParameter().pixelWidth = width * scale;
PSP_CoreParameter().pixelHeight = height * scale;

if (UpdateScreenScale(width, height)) {
NativeMessageReceived("gpu_resized", "");
}

}

void App::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) {

0 comments on commit 0e9f53c

Please sign in to comment.
You can’t perform that action at this time.