From 93b8f68b2e9ddc450ce63f1b6e1806960312d803 Mon Sep 17 00:00:00 2001 From: skallweitNV <64953474+skallweitNV@users.noreply.github.com> Date: Tue, 19 Dec 2023 00:16:14 +0100 Subject: macos/vulkan support (#3418) --- tools/gfx/apple/cocoa-util.h | 12 ++++++++++++ tools/gfx/apple/cocoa-util.mm | 15 +++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tools/gfx/apple/cocoa-util.h create mode 100644 tools/gfx/apple/cocoa-util.mm (limited to 'tools/gfx/apple') 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 + +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 -- cgit v1.2.3