null_window.c 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. //========================================================================
  2. // GLFW 3.4 - www.glfw.org
  3. //------------------------------------------------------------------------
  4. // Copyright (c) 2016 Google Inc.
  5. // Copyright (c) 2016-2019 Camilla Löwy <[email protected]>
  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. #include "internal.h"
  30. static int createNativeWindow(_GLFWwindow* window,
  31. const _GLFWwndconfig* wndconfig)
  32. {
  33. window->null.width = wndconfig->width;
  34. window->null.height = wndconfig->height;
  35. return GLFW_TRUE;
  36. }
  37. //////////////////////////////////////////////////////////////////////////
  38. ////// GLFW platform API //////
  39. //////////////////////////////////////////////////////////////////////////
  40. int _glfwPlatformCreateWindow(_GLFWwindow* window,
  41. const _GLFWwndconfig* wndconfig,
  42. const _GLFWctxconfig* ctxconfig,
  43. const _GLFWfbconfig* fbconfig)
  44. {
  45. if (!createNativeWindow(window, wndconfig))
  46. return GLFW_FALSE;
  47. if (ctxconfig->client != GLFW_NO_API)
  48. {
  49. if (ctxconfig->source == GLFW_NATIVE_CONTEXT_API ||
  50. ctxconfig->source == GLFW_OSMESA_CONTEXT_API)
  51. {
  52. if (!_glfwInitOSMesa())
  53. return GLFW_FALSE;
  54. if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
  55. return GLFW_FALSE;
  56. }
  57. else
  58. {
  59. _glfwInputError(GLFW_API_UNAVAILABLE, "Null: EGL not available");
  60. return GLFW_FALSE;
  61. }
  62. }
  63. return GLFW_TRUE;
  64. }
  65. void _glfwPlatformDestroyWindow(_GLFWwindow* window)
  66. {
  67. if (window->context.destroy)
  68. window->context.destroy(window);
  69. }
  70. void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
  71. {
  72. }
  73. void _glfwPlatformSetWindowIcon(_GLFWwindow* window, int count,
  74. const GLFWimage* images)
  75. {
  76. }
  77. void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
  78. _GLFWmonitor* monitor,
  79. int xpos, int ypos,
  80. int width, int height,
  81. int refreshRate)
  82. {
  83. }
  84. void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
  85. {
  86. }
  87. void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
  88. {
  89. }
  90. void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
  91. {
  92. if (width)
  93. *width = window->null.width;
  94. if (height)
  95. *height = window->null.height;
  96. }
  97. void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
  98. {
  99. window->null.width = width;
  100. window->null.height = height;
  101. }
  102. void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
  103. int minwidth, int minheight,
  104. int maxwidth, int maxheight)
  105. {
  106. }
  107. void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int n, int d)
  108. {
  109. }
  110. void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
  111. {
  112. if (width)
  113. *width = window->null.width;
  114. if (height)
  115. *height = window->null.height;
  116. }
  117. void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
  118. int* left, int* top,
  119. int* right, int* bottom)
  120. {
  121. }
  122. void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
  123. float* xscale, float* yscale)
  124. {
  125. if (xscale)
  126. *xscale = 1.f;
  127. if (yscale)
  128. *yscale = 1.f;
  129. }
  130. void _glfwPlatformIconifyWindow(_GLFWwindow* window)
  131. {
  132. }
  133. void _glfwPlatformRestoreWindow(_GLFWwindow* window)
  134. {
  135. }
  136. void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
  137. {
  138. }
  139. int _glfwPlatformWindowMaximized(_GLFWwindow* window)
  140. {
  141. return GLFW_FALSE;
  142. }
  143. int _glfwPlatformWindowHovered(_GLFWwindow* window)
  144. {
  145. return GLFW_FALSE;
  146. }
  147. int _glfwPlatformFramebufferTransparent(_GLFWwindow* window)
  148. {
  149. return GLFW_FALSE;
  150. }
  151. void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
  152. {
  153. }
  154. void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
  155. {
  156. }
  157. void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
  158. {
  159. }
  160. float _glfwPlatformGetWindowOpacity(_GLFWwindow* window)
  161. {
  162. return 1.f;
  163. }
  164. void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity)
  165. {
  166. }
  167. void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled)
  168. {
  169. }
  170. GLFWbool _glfwPlatformRawMouseMotionSupported(void)
  171. {
  172. return GLFW_FALSE;
  173. }
  174. void _glfwPlatformShowWindow(_GLFWwindow* window)
  175. {
  176. }
  177. void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
  178. {
  179. }
  180. void _glfwPlatformUnhideWindow(_GLFWwindow* window)
  181. {
  182. }
  183. void _glfwPlatformHideWindow(_GLFWwindow* window)
  184. {
  185. }
  186. void _glfwPlatformFocusWindow(_GLFWwindow* window)
  187. {
  188. }
  189. int _glfwPlatformWindowFocused(_GLFWwindow* window)
  190. {
  191. return GLFW_FALSE;
  192. }
  193. int _glfwPlatformWindowIconified(_GLFWwindow* window)
  194. {
  195. return GLFW_FALSE;
  196. }
  197. int _glfwPlatformWindowVisible(_GLFWwindow* window)
  198. {
  199. return GLFW_FALSE;
  200. }
  201. void _glfwPlatformPollEvents(void)
  202. {
  203. }
  204. void _glfwPlatformWaitEvents(void)
  205. {
  206. }
  207. void _glfwPlatformWaitEventsTimeout(double timeout)
  208. {
  209. }
  210. void _glfwPlatformPostEmptyEvent(void)
  211. {
  212. }
  213. void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
  214. {
  215. }
  216. void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
  217. {
  218. }
  219. void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
  220. {
  221. }
  222. int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
  223. const GLFWimage* image,
  224. int xhot, int yhot)
  225. {
  226. return GLFW_TRUE;
  227. }
  228. int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
  229. {
  230. return GLFW_TRUE;
  231. }
  232. void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
  233. {
  234. }
  235. void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
  236. {
  237. }
  238. void _glfwPlatformSetClipboardString(const char* string)
  239. {
  240. }
  241. const char* _glfwPlatformGetClipboardString(void)
  242. {
  243. return NULL;
  244. }
  245. const char* _glfwPlatformGetScancodeName(int scancode)
  246. {
  247. return "";
  248. }
  249. int _glfwPlatformGetKeyScancode(int key)
  250. {
  251. return -1;
  252. }
  253. void _glfwPlatformGetRequiredInstanceExtensions(char** extensions)
  254. {
  255. }
  256. int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
  257. VkPhysicalDevice device,
  258. uint32_t queuefamily)
  259. {
  260. return GLFW_FALSE;
  261. }
  262. VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
  263. _GLFWwindow* window,
  264. const VkAllocationCallbacks* allocator,
  265. VkSurfaceKHR* surface)
  266. {
  267. // This seems like the most appropriate error to return here
  268. return VK_ERROR_INITIALIZATION_FAILED;
  269. }