summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-02-14 13:26:46 +0100
committerMichael Lutz <michi@icosahedron.de>2021-02-14 14:16:40 +0100
commit8d780e0607b8f313251710639fb2642f6e733b97 (patch)
tree33eaa9690b73bb94e0a614d38916f8af5bfc62e1 /src
parentf175e38666e2f21f5873e95ca52f5aa321e8d3bf (diff)
downloadopenttd-8d780e0607b8f313251710639fb2642f6e733b97.tar.xz
Add: [OSX] Automatic zoom level suggestion for Cocoa video driver.
Diffstat (limited to 'src')
-rw-r--r--src/video/cocoa/cocoa_v.h1
-rw-r--r--src/video/cocoa/cocoa_v.mm6
2 files changed, 7 insertions, 0 deletions
diff --git a/src/video/cocoa/cocoa_v.h b/src/video/cocoa/cocoa_v.h
index 596a9e27d..5dd3d1d1f 100644
--- a/src/video/cocoa/cocoa_v.h
+++ b/src/video/cocoa/cocoa_v.h
@@ -73,6 +73,7 @@ public:
protected:
Dimension GetScreenSize() const override;
+ float GetDPIScale() override;
private:
bool PollEvent();
diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm
index c21edc7ac..4c6ce6cab 100644
--- a/src/video/cocoa/cocoa_v.mm
+++ b/src/video/cocoa/cocoa_v.mm
@@ -294,6 +294,12 @@ Dimension VideoDriver_Cocoa::GetScreenSize() const
return { static_cast<uint>(NSWidth(frame)), static_cast<uint>(NSHeight(frame)) };
}
+/** Get DPI scale of our window. */
+float VideoDriver_Cocoa::GetDPIScale()
+{
+ return this->cocoaview != nil ? [ this->cocoaview getContentsScale ] : 1.0f;
+}
+
/**
* Are we in fullscreen mode?
* @return whether fullscreen mode is currently used