// Copyright 2020-2022 The Defold Foundation // Copyright 2014-2020 King // Copyright 2009-2014 Ragnar Svensson, Christian Murray // Licensed under the Defold License version 1.0 (the "License"); you may not use // this file except in compliance with the License. // // You may obtain a copy of the License, together with FAQs at // https://www.defold.com/license // // Unless required by applicable law or agreed to in writing, software distributed // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, either express or implied. See the License for the // specific language governing permissions and limitations under the License. #ifndef DMSDK_GRAPHICS_NATIVE_H #define DMSDK_GRAPHICS_NATIVE_H // Include platform specific headers, typedef unknowns to void* #if defined(__APPLE_CC__) #include #else typedef void* id; #endif #if defined(ANDROID) #include #include #include #include #else typedef void* EGLContext; typedef void* EGLSurface; typedef void* JavaVM; typedef void* jobject; typedef void* android_app; #endif #if defined(_WIN32) #include #else typedef void* HWND; typedef void* HGLRC; #endif #if defined(__linux__) && !defined(ANDROID) #include #else typedef void* Window; typedef void* GLXContext; #endif #if defined(__EMSCRIPTEN__) // HTML5 (Emscripten) not supported #endif namespace dmGraphics { /*# SDK Graphics API documentation * * Platform specific native graphics functions. * * @document * @name Graphics * @namespace dmGraphics * @path engine/dlib/src/dmsdk/graphics/graphics_native.h */ /*# get iOS UIWindow * * Get iOS UIWindow native handle (id). Any other platform return zero. * * @name dmGraphics::GetNativeiOSUIWindow * @return id [type:id] native handle */ id GetNativeiOSUIWindow(void); /*# get iOS UIView * * Get iOS UIView native handle (id). Any other platform return zero. * * @name dmGraphics::GetNativeiOSUIView * @return id [type:id] native handle */ id GetNativeiOSUIView(void); /*# get iOS EAGLContext * * Get iOS EAGLContext native handle (id). Any other platform return zero. * * @name dmGraphics::GetNativeiOSEAGLContext * @return id [type:id] native handle */ id GetNativeiOSEAGLContext(void); /*# get OSX NSWindow * * Get OSX NSWindow native handle (id). Any other platform return zero. * * @name dmGraphics::GetNativeOSXNSWindow * @return id [type:id] native handle */ id GetNativeOSXNSWindow(void); /*# get OSX NSView * * Get OSX NSView native handle (id). Any other platform return zero. * * @name dmGraphics::GetNativeOSXNSView * @return id [type:id] native handle */ id GetNativeOSXNSView(void); /*# get OSX NSOpenGLContext * * Get OSX NSOpenGLContext native handle (id). Any other platform return zero. * * @name dmGraphics::GetNativeOSXNSOpenGLContext * @return id [type:id] native handle */ id GetNativeOSXNSOpenGLContext(void); /*# get Win32 HWND * * Get Win32 windows native handle (HWND). Any other platform return zero. * * @name dmGraphics::GetNativeWindowsHWND * @return HWND [type:HWND] native handle */ HWND GetNativeWindowsHWND(void); /*# get Win32 HGLRC * * Get Win32 gl rendercontext native handle (HGLRC). Any other platform return zero. * * @name dmGraphics::GetNativeWindowsHGLRC * @return HGLRC [type:HGLRC] native handle */ HGLRC GetNativeWindowsHGLRC(void); /*# get Android EGLContext * * Get Android EGLContext native handle (EGLContext). Any other platform return zero. * * @name dmGraphics::GetNativeAndroidEGLContext * @return EGLContext [type:EGLContext] native handle */ EGLContext GetNativeAndroidEGLContext(void); /*# get Android EGLSurface * * Get Android EGLSurface native handle (EGLSurface). Any other platform return zero. * * @name dmGraphics::GetNativeAndroidEGLSurface * @return EGLSurface [type:EGLSurface] native handle */ EGLSurface GetNativeAndroidEGLSurface(void); /*# get Android native JavaVM * * Get Android JavaVM ptr. Any other platform return zero. * * @name dmGraphics::GetNativeAndroidJavaVM * @return JavaVM* [type:JavaVM*] native handle */ JavaVM* GetNativeAndroidJavaVM(void); /*# get Android native jobject * * Get Android native jobject. Any other platform return zero. * * @name dmGraphics::GetNativeAndroidActivity * @return jobject [type:jobject] native handle */ jobject GetNativeAndroidActivity(void); /*# get Android app object * * Get Android app object. Any other platform return zero. * * @name dmGraphics::GetNativeAndroidApp * @return app [type:struct android_app*] native handle */ android_app* GetNativeAndroidApp(void); /*# get Linux X11Window * * Get Linux X11Window windows native handle (Window). Any other platform return zero. * * @name dmGraphics::GetNativeX11Window * @return Window [type:Window] native handle */ Window GetNativeX11Window(void); /*# get Linux X11GLXContext * * Get Linux X11GLXContext native handle (GLXContext). Any other platform return zero. * * @name dmGraphics::GetNativeX11GLXContext * @return GLXContext [type:GLXContext] native handle */ GLXContext GetNativeX11GLXContext(void); } #endif // DMSDK_GRAPHICS_NATIVE_H