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