summaryrefslogtreecommitdiffstats
path: root/tools/gfx/apple
diff options
context:
space:
mode:
authorskallweitNV <64953474+skallweitNV@users.noreply.github.com>2023-12-19 00:16:14 +0100
committerGitHub <noreply@github.com>2023-12-18 15:16:14 -0800
commit93b8f68b2e9ddc450ce63f1b6e1806960312d803 (patch)
treed5c9c38efe1e7c86637c4be6157595b44a5c4856 /tools/gfx/apple
parentb6da04424aff71ddba9629c94401a9a897b152a0 (diff)
macos/vulkan support (#3418)
Diffstat (limited to 'tools/gfx/apple')
-rw-r--r--tools/gfx/apple/cocoa-util.h12
-rw-r--r--tools/gfx/apple/cocoa-util.mm15
2 files changed, 27 insertions, 0 deletions
diff --git a/tools/gfx/apple/cocoa-util.h b/tools/gfx/apple/cocoa-util.h
new file mode 100644
index 000000000..80467d8a4
--- /dev/null
+++ b/tools/gfx/apple/cocoa-util.h
@@ -0,0 +1,12 @@
+#pragma once
+
+namespace gfx {
+
+// Utility functions for Cocoa
+struct CocoaUtil {
+
+ static void getNSViewRectSize(void* nsview, int* widthOut, int* heightOut);
+
+};
+
+}
diff --git a/tools/gfx/apple/cocoa-util.mm b/tools/gfx/apple/cocoa-util.mm
new file mode 100644
index 000000000..45b1c3df0
--- /dev/null
+++ b/tools/gfx/apple/cocoa-util.mm
@@ -0,0 +1,15 @@
+#include "cocoa-util.h"
+
+#import <Cocoa/Cocoa.h>
+
+namespace gfx {
+
+void CocoaUtil::getNSViewRectSize(void* nsview, int* widthOut, int* heightOut)
+{
+ NSView* view = (NSView*)nsview;
+ NSRect rect = [view frame];
+ *widthOut = rect.size.width;
+ *heightOut = rect.size.height;
+}
+
+} \ No newline at end of file