Skip to content
This repository has been archived by the owner on Feb 1, 2025. It is now read-only.

Latest commit

 

History

History
30 lines (20 loc) · 729 Bytes

platform-behavior.md

File metadata and controls

30 lines (20 loc) · 729 Bytes

Windows

const xwin::State& state = xwin::getXWinState();

#if defined(XWIN_WINDOWS)
  HINSTANCE hinstance = state.hinstance;
  HWND hwnd = window->hwnd;
#endif

MacOS

On MacOS, CrossWindow creates an NSApplication in its MacOS specific main function, and a pointer to this is accessible from xwin::getXWinState().

The NSApplication is used to create NSWindow and NSView objects, with Views inside of Windows on MacOS.

A xwin::MacOSWindow object is accessible by grabbing a window's delegate:

const xwin::State& state = xwin::getXWinState();

#if defined(XWIN_MACOS)
  NSApplication app = state.application;
  NSWindow* window = window->window;
  NSView* view = window->view;
#endif