1 2 // Copyright Michael D. Parker 2018. 3 // Distributed under the Boost Software License, Version 1.0. 4 // (See accompanying file LICENSE_1_0.txt or copy at 5 // http://www.boost.org/LICENSE_1_0.txt) 6 7 module bindbc.sdl.bind.sdlsystem; 8 9 import bindbc.sdl.config; 10 import bindbc.sdl.bind.sdlrender : SDL_Renderer; 11 import bindbc.sdl.bind.sdlstdinc : SDL_bool; 12 13 version(Android) { 14 enum int SDL_ANDROID_EXTERNAL_STORAGE_READ = 0x01; 15 enum int SDL_ANDROID_EXTERNAL_STORAGE_WRITE = 0x02; 16 } 17 18 static if(sdlSupport >= SDLSupport.sdl201) { 19 version(Windows) struct IDirect3DDevice9; 20 } 21 22 static if(sdlSupport >= SDLSupport.sdl204) { 23 version(Windows) { 24 extern(C) nothrow alias SDL_WindowsMessageHook = void function(void*,void*,uint,ulong,long); 25 } 26 } 27 28 version(BindSDL_Static) { 29 extern(C) @nogc nothrow { 30 version(Android) { 31 void* SDL_AndroidGetJNIEnv(); 32 void* SDL_AndroidGetActivity(); 33 const(char)* SDL_AndroidGetInternalStoragePath(); 34 int SDL_AndroidGetInternalStorageState(); 35 const(char)* SDL_AndroidGetExternalStoragePath(); 36 37 static if(sdlSupport >= SDLSupport.sdl208) { 38 SDL_bool SDL_IsAndroidTV(); 39 } 40 static if(sdlSupport >= SDLSupport.sdl209) { 41 SDL_bool SDL_IsChromebook(); 42 SDL_bool SDL_IsDeXMode(); 43 void SDL_AndroidBackButton(); 44 } 45 } 46 else version(Windows) { 47 static if(sdlSupport >= SDLSupport.sdl201) { 48 int SDL_Direct3D9GetAdapterIndex(int); 49 IDirect3DDevice9* SDL_RenderGetD3D9Device(SDL_Renderer*); 50 } 51 static if(sdlSupport >= SDLSupport.sdl202) { 52 SDL_bool SDL_DXGIGetOutputInfo(int,int*,int*); 53 } 54 static if(sdlSupport >= SDLSupport.sdl204) { 55 void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook,void*); 56 } 57 } 58 else version(linux) { 59 static if(sdlSupport >= SDLSupport.sdl209) { 60 int SDL_LinuxSetThreadPriority(long,int); 61 } 62 } 63 } 64 } 65 else { 66 version(Android) { 67 extern(C) @nogc nothrow { 68 alias pSDL_AndroidGetJNIEnv = void* function(); 69 alias pSDL_AndroidGetActivity = void* function(); 70 alias pSDL_AndroidGetInternalStoragePath = const(char)* function(); 71 alias pSDL_AndroidGetInternalStorageState = int function(); 72 alias pSDL_AndroidGetExternalStoragePath = const(char)* function(); 73 } 74 75 __gshared { 76 pSDL_AndroidGetJNIEnv SDL_AndroidGetJNIEnv; 77 pSDL_AndroidGetActivity SDL_AndroidGetActivity; 78 79 pSDL_AndroidGetInternalStoragePath SDL_AndroidGetInternalStoragePath; 80 pSDL_AndroidGetInternalStorageState SDL_AndroidGetInternalStorageState; 81 pSDL_AndroidGetExternalStoragePath SDL_AndroidGetExternalStoragePath; 82 } 83 84 static if(sdlSupport >= SDLSupport.sdl208) { 85 extern(C) @nogc nothrow { 86 alias pSDL_IsAndroidTV = SDL_bool function(); 87 } 88 89 __gshared { 90 pSDL_IsAndroidTV SDL_IsAndroidTV; 91 } 92 } 93 94 static if(sdlSupport >= SDLSupport.sdl209) { 95 extern(C) @nogc nothrow { 96 alias pSDL_IsChromebook = SDL_bool function(); 97 alias pSDL_IsDeXMode = SDL_bool function(); 98 alias pSDL_AndroidBackButton = void function(); 99 } 100 101 __gshared { 102 pSDL_IsChromebook SDL_IsChromebook; 103 pSDL_IsDeXMode SDL_IsDeXMode; 104 pSDL_AndroidBackButton SDL_AndroidBackButton; 105 } 106 } 107 } 108 else version(Windows) { 109 static if(sdlSupport >= SDLSupport.sdl201) { 110 extern(C) @nogc nothrow { 111 alias pSDL_Direct3D9GetAdapterIndex = int function(int); 112 alias pSDL_RenderGetD3D9Device = IDirect3DDevice9* function(SDL_Renderer*); 113 } 114 115 __gshared { 116 pSDL_Direct3D9GetAdapterIndex SDL_Direct3D9GetAdapterIndex ; 117 pSDL_RenderGetD3D9Device SDL_RenderGetD3D9Device; 118 } 119 } 120 121 static if(sdlSupport >= SDLSupport.sdl202) { 122 extern(C) @nogc nothrow { 123 alias pSDL_DXGIGetOutputInfo = SDL_bool function(int,int*,int*); 124 } 125 126 __gshared { 127 pSDL_DXGIGetOutputInfo SDL_DXGIGetOutputInfo; 128 } 129 } 130 131 static if(sdlSupport >= SDLSupport.sdl204) { 132 extern(C) @nogc nothrow { 133 alias pSDL_SetWindowsMessageHook = void function(SDL_WindowsMessageHook,void*); 134 } 135 136 __gshared { 137 pSDL_SetWindowsMessageHook SDL_SetWindowsMessageHook; 138 } 139 } 140 } 141 else version(linux) { 142 static if(sdlSupport >= SDLSupport.sdl209) { 143 extern(C) @nogc nothrow { 144 alias pSDL_LinuxSetThreadPriority = int function(long,int); 145 } 146 147 __gshared { 148 pSDL_LinuxSetThreadPriority SDL_LinuxSetThreadPriority; 149 } 150 } 151 } 152 }