Remove gnCreateWindowSurface, add platform specific window creation
functions
This commit is contained in:
@@ -3,16 +3,12 @@
|
||||
#import <QuartzCore/CAMetalLayer.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
#import <Metal/Metal.h>
|
||||
#define GLFW_EXPOSE_NATIVE_COCOA
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <GLFW/glfw3native.h>
|
||||
|
||||
void mtlObjectCSetContentViewsLayer(void* window, void* layer) {
|
||||
void mtlObjectCSetContentViewsLayer(void* view, void* layer) {
|
||||
[CATransaction begin];
|
||||
[CATransaction setDisableActions:YES];
|
||||
|
||||
NSWindow* nsWindow = (NSWindow*)glfwGetCocoaWindow((GLFWwindow*)window);
|
||||
NSView* contentView = [nsWindow contentView];
|
||||
NSView* contentView = (__bridge NSView*)view;
|
||||
|
||||
CAMetalLayer* metalLayer = (__bridge CAMetalLayer*)layer;
|
||||
|
||||
@@ -22,17 +18,17 @@ void mtlObjectCSetContentViewsLayer(void* window, void* layer) {
|
||||
[CATransaction commit];
|
||||
}
|
||||
|
||||
void* mtlCreateContentView(void* targetWindow) {
|
||||
NSWindow* window = (__bridge NSWindow*)targetWindow;
|
||||
NSRect frame = [[window contentView] frame]; // fallback size
|
||||
NSView* contentView = [[NSView alloc] initWithFrame:frame];
|
||||
[window setContentView:contentView];
|
||||
// void* mtlCreateContentView(void* targetWindow) {
|
||||
// NSWindow* window = (__bridge NSWindow*)targetWindow;
|
||||
// NSRect frame = [[window contentView] frame]; // fallback size
|
||||
// NSView* contentView = [[NSView alloc] initWithFrame:frame];
|
||||
// [window setContentView:contentView];
|
||||
|
||||
if (contentView == nullptr)
|
||||
frame = NSMakeRect(0, 0, window.frame.size.width, window.frame.size.height);
|
||||
// if (contentView == nullptr)
|
||||
// frame = NSMakeRect(0, 0, window.frame.size.width, window.frame.size.height);
|
||||
|
||||
return contentView;
|
||||
}
|
||||
// return contentView;
|
||||
// }
|
||||
|
||||
// void* mtlInitContentView(void* targetView) {
|
||||
// NSView* view = (__bridge NSView*)targetView;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
void mtlObjectCSetContentViewsLayer(void* window, void* layer);
|
||||
void* mtlCreateContentView(void* targetWindow);
|
||||
void mtlObjectCSetContentViewsLayer(void* view, void* layer);
|
||||
// void* mtlCreateContentView(void* targetView);
|
||||
void mtlInitializeMetalLayer(void* layer, bool vsync);
|
||||
|
Reference in New Issue
Block a user