1 /// Translated from C to D 2 module glfw3.null_window; 3 4 extern(C): @nogc: nothrow: __gshared: 5 //======================================================================== 6 // GLFW 3.3 - www.glfw.org 7 //------------------------------------------------------------------------ 8 // Copyright (c) 2016 Google Inc. 9 // Copyright (c) 2016-2019 Camilla Löwy <elmindreda@glfw.org> 10 // 11 // This software is provided 'as-is', without any express or implied 12 // warranty. In no event will the authors be held liable for any damages 13 // arising from the use of this software. 14 // 15 // Permission is granted to anyone to use this software for any purpose, 16 // including commercial applications, and to alter it and redistribute it 17 // freely, subject to the following restrictions: 18 // 19 // 1. The origin of this software must not be misrepresented; you must not 20 // claim that you wrote the original software. If you use this software 21 // in a product, an acknowledgment in the product documentation would 22 // be appreciated but is not required. 23 // 24 // 2. Altered source versions must be plainly marked as such, and must not 25 // be misrepresented as being the original software. 26 // 27 // 3. This notice may not be removed or altered from any source 28 // distribution. 29 // 30 //======================================================================== 31 // It is fine to use C99 in this file because it will not be built with VS 32 //======================================================================== 33 34 import glfw3.internal; 35 36 37 static int createNativeWindow(_GLFWwindow* window, const(_GLFWwndconfig)* wndconfig) { 38 window.null_.width = wndconfig.width; 39 window.null_.height = wndconfig.height; 40 41 return GLFW_TRUE; 42 } 43 44 45 ////////////////////////////////////////////////////////////////////////// 46 ////// GLFW platform API ////// 47 ////////////////////////////////////////////////////////////////////////// 48 49 int _glfwPlatformCreateWindow(_GLFWwindow* window, const(_GLFWwndconfig)* wndconfig, const(_GLFWctxconfig)* ctxconfig, const(_GLFWfbconfig)* fbconfig) { 50 if (!createNativeWindow(window, wndconfig)) 51 return GLFW_FALSE; 52 53 if (ctxconfig.client != GLFW_NO_API) 54 { 55 if (ctxconfig.source == GLFW_NATIVE_CONTEXT_API || 56 ctxconfig.source == GLFW_OSMESA_CONTEXT_API) 57 { 58 if (!_glfwInitOSMesa()) 59 return GLFW_FALSE; 60 if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) 61 return GLFW_FALSE; 62 } 63 else 64 { 65 _glfwInputError(GLFW_API_UNAVAILABLE, "Null: EGL not available"); 66 return GLFW_FALSE; 67 } 68 } 69 70 return GLFW_TRUE; 71 } 72 73 void _glfwPlatformDestroyWindow(_GLFWwindow* window) { 74 if (window.context.destroy) 75 window.context.destroy(window); 76 } 77 78 void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const(char)* title) { 79 } 80 81 void _glfwPlatformSetWindowIcon(_GLFWwindow* window, int count, const(GLFWimage)* images) { 82 } 83 84 void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate) { 85 } 86 87 void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos) { 88 } 89 90 void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos) { 91 } 92 93 void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height) { 94 if (width) 95 *width = window.null_.width; 96 if (height) 97 *height = window.null_.height; 98 } 99 100 void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) { 101 window.null_.width = width; 102 window.null_.height = height; 103 } 104 105 void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight) { 106 } 107 108 void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int n, int d) { 109 } 110 111 void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height) { 112 if (width) 113 *width = window.null_.width; 114 if (height) 115 *height = window.null_.height; 116 } 117 118 void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, int* left, int* top, int* right, int* bottom) { 119 } 120 121 void _glfwPlatformGetWindowContentScale(_GLFWwindow* window, float* xscale, float* yscale) { 122 if (xscale) 123 *xscale = 1.0f; 124 if (yscale) 125 *yscale = 1.0f; 126 } 127 128 void _glfwPlatformIconifyWindow(_GLFWwindow* window) { 129 } 130 131 void _glfwPlatformRestoreWindow(_GLFWwindow* window) { 132 } 133 134 void _glfwPlatformMaximizeWindow(_GLFWwindow* window) { 135 } 136 137 int _glfwPlatformWindowMaximized(_GLFWwindow* window) { 138 return GLFW_FALSE; 139 } 140 141 int _glfwPlatformWindowHovered(_GLFWwindow* window) { 142 return GLFW_FALSE; 143 } 144 145 int _glfwPlatformFramebufferTransparent(_GLFWwindow* window) { 146 return GLFW_FALSE; 147 } 148 149 void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled) { 150 } 151 152 void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled) { 153 } 154 155 void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled) { 156 } 157 158 float _glfwPlatformGetWindowOpacity(_GLFWwindow* window) { 159 return 1.0f; 160 } 161 162 void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity) { 163 } 164 165 void _glfwPlatformSetRawMouseMotion(_GLFWwindow* window, GLFWbool enabled) { 166 } 167 168 GLFWbool _glfwPlatformRawMouseMotionSupported() { 169 return GLFW_FALSE; 170 } 171 172 void _glfwPlatformShowWindow(_GLFWwindow* window) { 173 } 174 175 176 void _glfwPlatformRequestWindowAttention(_GLFWwindow* window) { 177 } 178 179 void _glfwPlatformUnhideWindow(_GLFWwindow* window) { 180 } 181 182 void _glfwPlatformHideWindow(_GLFWwindow* window) { 183 } 184 185 void _glfwPlatformFocusWindow(_GLFWwindow* window) { 186 } 187 188 int _glfwPlatformWindowFocused(_GLFWwindow* window) { 189 return GLFW_FALSE; 190 } 191 192 int _glfwPlatformWindowIconified(_GLFWwindow* window) { 193 return GLFW_FALSE; 194 } 195 196 int _glfwPlatformWindowVisible(_GLFWwindow* window) { 197 return GLFW_FALSE; 198 } 199 200 void _glfwPlatformPollEvents() { 201 } 202 203 void _glfwPlatformWaitEvents() { 204 } 205 206 void _glfwPlatformWaitEventsTimeout(double timeout) { 207 } 208 209 void _glfwPlatformPostEmptyEvent() { 210 } 211 212 void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos) { 213 } 214 215 void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y) { 216 } 217 218 void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode) { 219 } 220 221 int _glfwPlatformCreateCursor(_GLFWcursor* cursor, const(GLFWimage)* image, int xhot, int yhot) { 222 return GLFW_TRUE; 223 } 224 225 int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape) { 226 return GLFW_TRUE; 227 } 228 229 void _glfwPlatformDestroyCursor(_GLFWcursor* cursor) { 230 } 231 232 void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor) { 233 } 234 235 void _glfwPlatformSetClipboardString(const(char)* string) { 236 } 237 238 const(char)* _glfwPlatformGetClipboardString() { 239 return null; 240 } 241 242 const(char)* _glfwPlatformGetScancodeName(int scancode) { 243 return ""; 244 } 245 246 int _glfwPlatformGetKeyScancode(int key) { 247 return -1; 248 } 249 250 void _glfwPlatformGetRequiredInstanceExtensions(char** extensions) { 251 } 252 253 int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint queuefamily) { 254 return GLFW_FALSE; 255 } 256 257 VkResult _glfwPlatformCreateWindowSurface(VkInstance instance, _GLFWwindow* window, const(VkAllocationCallbacks)* allocator, VkSurfaceKHR* surface) { 258 // This seems like the most appropriate error to return here 259 return VK_ERROR_INITIALIZATION_FAILED; 260 }