forked from AcademySoftwareFoundation/MaterialX
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleWindowMac.cpp
More file actions
48 lines (38 loc) · 985 Bytes
/
SimpleWindowMac.cpp
File metadata and controls
48 lines (38 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// Copyright Contributors to the MaterialX Project
// SPDX-License-Identifier: Apache-2.0
//
#if defined(__APPLE__)
#ifndef TARGET_OS_IPHONE
#include <MaterialXRenderHw/SimpleWindow.h>
#include <MaterialXRenderHw/WindowCocoaWrappers.h>
MATERIALX_NAMESPACE_BEGIN
SimpleWindow::SimpleWindow() :
_width(0),
_height(0)
{
// Give a unique identifier to this window.
static unsigned int windowCount = 1;
_id = windowCount;
windowCount++;
}
bool SimpleWindow::initialize(const char* title,
unsigned int width, unsigned int height,
void* /*applicationShell*/)
{
void* win = NSUtilCreateWindow(width, height, title, true);
if (!win)
{
return false;
}
_windowWrapper = WindowWrapper::create(win);
return true;
}
SimpleWindow::~SimpleWindow()
{
void* hWnd = _windowWrapper->externalHandle();
NSUtilDisposeWindow(hWnd);
}
MATERIALX_NAMESPACE_END
#endif
#endif