Browse Source

Move new graphics APIs

Eugene Kozlov 8 years ago
parent
commit
f2c78c2ab8
2 changed files with 30 additions and 27 deletions
  1. 23 20
      Source/Urho3D/Graphics/Graphics.cpp
  2. 7 7
      Source/Urho3D/Graphics/Graphics.h

+ 23 - 20
Source/Urho3D/Graphics/Graphics.cpp

@@ -227,6 +227,29 @@ int Graphics::GetMonitorCount() const
     return SDL_GetNumVideoDisplays();
 }
 
+int Graphics::GetCurrentMonitor() const
+{
+    if (!window_)
+        return 0;
+
+    return SDL_GetWindowDisplayIndex(window_);
+}
+
+bool Graphics::GetMaximized() const
+{
+    if (!window_)
+        return false;
+
+    return SDL_GetWindowFlags(window_) & SDL_WINDOW_MAXIMIZED;
+}
+
+Vector3 Graphics::GetDisplayDPI() const
+{
+    Vector3 result;
+    SDL_GetDisplayDPI(0, &result.z_, &result.x_, &result.y_);
+    return result;
+}
+
 void Graphics::Maximize()
 {
     if (!window_)
@@ -379,26 +402,6 @@ void Graphics::CreateWindowIcon()
     }
 }
 
-int Graphics::GetCurrentMonitor() const
-{
-    return SDL_GetWindowDisplayIndex((SDL_Window*) this->GetSDLWindow());
-}
-
-bool Graphics::GetMaximized() const
-{
-    if (!window_)
-        return false;
-
-    return SDL_GetWindowFlags(window_) & SDL_WINDOW_MAXIMIZED;
-}
-
-Vector3 Graphics::GetDisplayDPI() const
-{
-    Vector3 result;
-    SDL_GetDisplayDPI(0, &result.z_, &result.x_, &result.y_);
-    return result;
-}
-
 void RegisterGraphicsLibrary(Context* context)
 {
     Animation::RegisterObject(context);

+ 7 - 7
Source/Urho3D/Graphics/Graphics.h

@@ -374,6 +374,13 @@ public:
     IntVector2 GetDesktopResolution(int monitor) const;
     /// Return the number of currently connected monitors.
     int GetMonitorCount() const;
+    /// Returns the index of the display containing the center of the window on success or a negative error code on failure.
+    int GetCurrentMonitor() const;
+    /// Returns true if window is maximized or runs in full screen mode.
+    bool GetMaximized() const;
+    /// Return display dpi information: (hdpi, vdpi, ddpi). On failure returns zero vector.
+    Vector3 GetDisplayDPI() const;
+
     /// Return hardware format for a compressed image format, or 0 if unsupported.
     unsigned GetFormat(CompressedFormat format) const;
     /// Return a shader variation by name and defines.
@@ -564,13 +571,6 @@ public:
     /// Return whether is using an OpenGL 3 context. Return always false on Direct3D9 & Direct3D11.
     static bool GetGL3Support();
 
-    /// Returns the index of the display containing the center of the window on success or a negative error code on failure.
-    int GetCurrentMonitor() const;
-    /// Returns true if window is maximized or runs in full screen mode.
-    bool GetMaximized() const;
-    /// Return display dpi information: (hdpi, vdpi, ddpi). On failure returns zero vector.
-    Vector3 GetDisplayDPI() const;
-
 private:
     /// Create the application window.
     bool OpenWindow(int width, int height, bool resizable, bool borderless);