MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / GetNativeWindowPointer

Function GetNativeWindowPointer

Source/Engine/Platform/SDL/SDLWindow.cpp:66–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66void* GetNativeWindowPointer(SDL_Window* window)
67{
68 void* windowPtr;
69 auto props = SDL_GetWindowProperties(window);
70#if PLATFORM_WINDOWS
71 windowPtr = SDL_GetPointerProperty(props, SDL_PROP_WINDOW_WIN32_HWND_POINTER, nullptr);
72#elif PLATFORM_LINUX
73 windowPtr = SDL_GetPointerProperty(props, SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER, nullptr);
74 if (windowPtr == nullptr)
75 windowPtr = (void*)SDL_GetNumberProperty(props, SDL_PROP_WINDOW_X11_WINDOW_NUMBER, 0);
76#elif PLATFORM_MAC
77 windowPtr = SDL_GetPointerProperty(props, SDL_PROP_WINDOW_COCOA_WINDOW_POINTER, nullptr);
78#elif PLATFORM_ANDROID
79 windowPtr = SDL_GetPointerProperty(props, SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER, nullptr);
80#elif PLATFORM_IOS
81 windowPtr = SDL_GetPointerProperty(props, SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER, nullptr);
82#elif PLATFORM_WEB
83 windowPtr = (void*)1; // Mock value (TODO: consider SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING)
84#else
85 static_assert(false, "unsupported platform");
86#endif
87 return windowPtr;
88}
89
90void SDLWindow::Init()
91{

Callers 1

SDLWindowMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected