Bladeren bron

Add monitor and refreshrate parameters to E_SCREENMODE

PredatorMF 8 jaren geleden
bovenliggende
commit
2bef979152

+ 3 - 1
Source/Urho3D/Graphics/Direct3D11/D3D11Graphics.cpp

@@ -404,7 +404,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
 
 #ifdef URHO3D_LOGGING
     String msg;
-    msg.AppendWithFormat("Set screen mode %dx%d %s", width_, height_, (fullscreen_ ? "fullscreen" : "windowed"));
+    msg.AppendWithFormat("Set screen mode %dx%d %s monitor %d", width_, height_, (fullscreen_ ? "fullscreen" : "windowed"), monitor_);
     if (borderless_)
         msg.Append(" borderless");
     if (resizable_)
@@ -423,6 +423,8 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
     eventData[P_BORDERLESS] = borderless_;
     eventData[P_RESIZABLE] = resizable_;
     eventData[P_HIGHDPI] = highDPI_;
+    eventData[P_MONITOR] = monitor_;
+    eventData[P_REFRESHRATE] = refreshRate_;
     SendEvent(E_SCREENMODE, eventData);
 
     return true;

+ 3 - 1
Source/Urho3D/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -510,7 +510,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
 
 #ifdef URHO3D_LOGGING
     String msg;
-    msg.AppendWithFormat("Set screen mode %dx%d %s", width_, height_, (fullscreen_ ? "fullscreen" : "windowed"));
+    msg.AppendWithFormat("Set screen mode %dx%d %s monitor %d", width_, height_, (fullscreen_ ? "fullscreen" : "windowed"), monitor_);
     if (borderless_)
         msg.Append(" borderless");
     if (resizable_)
@@ -529,6 +529,8 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
     eventData[P_BORDERLESS] = borderless_;
     eventData[P_RESIZABLE] = resizable_;
     eventData[P_HIGHDPI] = highDPI_;
+    eventData[P_MONITOR] = monitor_;
+    eventData[P_REFRESHRATE] = refreshRate_;
     SendEvent(E_SCREENMODE, eventData);
 
     return true;

+ 2 - 0
Source/Urho3D/Graphics/GraphicsEvents.h

@@ -36,6 +36,8 @@ URHO3D_EVENT(E_SCREENMODE, ScreenMode)
     URHO3D_PARAM(P_BORDERLESS, Borderless);        // bool
     URHO3D_PARAM(P_RESIZABLE, Resizable);          // bool
     URHO3D_PARAM(P_HIGHDPI, HighDPI);              // bool
+    URHO3D_PARAM(P_MONITOR, Monitor);              // int
+    URHO3D_PARAM(P_REFRESHRATE, RefreshRate);      // int
 }
 
 /// Window position changed.

+ 3 - 1
Source/Urho3D/Graphics/OpenGL/OGLGraphics.cpp

@@ -522,7 +522,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
 
 #ifdef URHO3D_LOGGING
     String msg;
-    msg.AppendWithFormat("Set screen mode %dx%d %s", width_, height_, (fullscreen_ ? "fullscreen" : "windowed"));
+    msg.AppendWithFormat("Set screen mode %dx%d %s monitor %d", width_, height_, (fullscreen_ ? "fullscreen" : "windowed"), monitor_);
     if (borderless_)
         msg.Append(" borderless");
     if (resizable_)
@@ -541,6 +541,8 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
     eventData[P_BORDERLESS] = borderless_;
     eventData[P_RESIZABLE] = resizable_;
     eventData[P_HIGHDPI] = highDPI_;
+    eventData[P_MONITOR] = monitor_;
+    eventData[P_REFRESHRATE] = refreshRate_;
     SendEvent(E_SCREENMODE, eventData);
 
     return true;