2016-10-13 15:24:51 +00:00
|
|
|
//========================================================================
|
2017-02-28 19:27:10 +00:00
|
|
|
// GLFW 3.3 - www.glfw.org
|
2016-10-13 15:24:51 +00:00
|
|
|
//------------------------------------------------------------------------
|
|
|
|
// Copyright (c) 2016 Google Inc.
|
2016-11-21 15:23:59 +00:00
|
|
|
// Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org>
|
2016-10-13 15:24:51 +00:00
|
|
|
//
|
|
|
|
// This software is provided 'as-is', without any express or implied
|
|
|
|
// warranty. In no event will the authors be held liable for any damages
|
|
|
|
// arising from the use of this software.
|
|
|
|
//
|
|
|
|
// Permission is granted to anyone to use this software for any purpose,
|
|
|
|
// including commercial applications, and to alter it and redistribute it
|
|
|
|
// freely, subject to the following restrictions:
|
|
|
|
//
|
|
|
|
// 1. The origin of this software must not be misrepresented; you must not
|
|
|
|
// claim that you wrote the original software. If you use this software
|
|
|
|
// in a product, an acknowledgment in the product documentation would
|
|
|
|
// be appreciated but is not required.
|
|
|
|
//
|
|
|
|
// 2. Altered source versions must be plainly marked as such, and must not
|
|
|
|
// be misrepresented as being the original software.
|
|
|
|
//
|
|
|
|
// 3. This notice may not be removed or altered from any source
|
|
|
|
// distribution.
|
|
|
|
//
|
|
|
|
//========================================================================
|
2016-08-30 22:53:19 +00:00
|
|
|
|
|
|
|
#include "internal.h"
|
|
|
|
|
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
static int createNativeWindow(_GLFWwindow* window,
|
|
|
|
const _GLFWwndconfig* wndconfig)
|
2016-08-30 22:53:19 +00:00
|
|
|
{
|
2017-02-28 19:27:10 +00:00
|
|
|
window->null.width = wndconfig->width;
|
|
|
|
window->null.height = wndconfig->height;
|
2016-08-30 22:53:19 +00:00
|
|
|
|
|
|
|
return GLFW_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
////// GLFW platform API //////
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|
|
|
const _GLFWwndconfig* wndconfig,
|
|
|
|
const _GLFWctxconfig* ctxconfig,
|
|
|
|
const _GLFWfbconfig* fbconfig)
|
|
|
|
{
|
2016-11-08 22:43:45 +00:00
|
|
|
if (!createNativeWindow(window, wndconfig))
|
2016-08-30 22:53:19 +00:00
|
|
|
return GLFW_FALSE;
|
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
if (ctxconfig->client != GLFW_NO_API)
|
|
|
|
{
|
2017-02-28 18:23:25 +00:00
|
|
|
if (ctxconfig->source == GLFW_NATIVE_CONTEXT_API ||
|
|
|
|
ctxconfig->source == GLFW_OSMESA_CONTEXT_API)
|
2016-11-08 22:43:45 +00:00
|
|
|
{
|
|
|
|
if (!_glfwInitOSMesa())
|
|
|
|
return GLFW_FALSE;
|
|
|
|
if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig))
|
|
|
|
return GLFW_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-02-28 19:27:10 +00:00
|
|
|
_glfwInputError(GLFW_API_UNAVAILABLE, "Null: EGL not available");
|
2016-10-13 15:24:51 +00:00
|
|
|
return GLFW_FALSE;
|
2016-11-08 22:43:45 +00:00
|
|
|
}
|
2016-10-13 15:24:51 +00:00
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
|
|
|
return GLFW_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|
|
|
{
|
|
|
|
if (window->context.destroy)
|
|
|
|
window->context.destroy(window);
|
|
|
|
}
|
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
|
|
|
void _glfwPlatformSetWindowIcon(_GLFWwindow* window, int count,
|
2016-10-13 15:24:51 +00:00
|
|
|
const GLFWimage* images)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
|
|
|
void _glfwPlatformSetWindowMonitor(_GLFWwindow* window,
|
|
|
|
_GLFWmonitor* monitor,
|
|
|
|
int xpos, int ypos,
|
|
|
|
int width, int height,
|
2016-10-13 15:24:51 +00:00
|
|
|
int refreshRate)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
|
|
|
void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
|
|
|
void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
|
|
|
|
{
|
2016-10-13 15:24:51 +00:00
|
|
|
if (width)
|
2017-02-28 19:27:10 +00:00
|
|
|
*width = window->null.width;
|
2016-10-13 15:24:51 +00:00
|
|
|
if (height)
|
2017-02-28 19:27:10 +00:00
|
|
|
*height = window->null.height;
|
2016-08-30 22:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
|
|
|
{
|
2017-02-28 19:27:10 +00:00
|
|
|
window->null.width = width;
|
|
|
|
window->null.height = height;
|
2016-08-30 22:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window,
|
|
|
|
int minwidth, int minheight,
|
2016-10-13 15:24:51 +00:00
|
|
|
int maxwidth, int maxheight)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int n, int d)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
|
2016-08-30 22:53:19 +00:00
|
|
|
{
|
2016-10-13 15:24:51 +00:00
|
|
|
if (width)
|
2017-02-28 19:27:10 +00:00
|
|
|
*width = window->null.width;
|
2016-10-13 15:24:51 +00:00
|
|
|
if (height)
|
2017-02-28 19:27:10 +00:00
|
|
|
*height = window->null.height;
|
2016-08-30 22:53:19 +00:00
|
|
|
}
|
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
|
|
|
|
int* left, int* top,
|
2016-08-30 22:53:19 +00:00
|
|
|
int* right, int* bottom)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformIconifyWindow(_GLFWwindow* window)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformRestoreWindow(_GLFWwindow* window)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
int _glfwPlatformWindowMaximized(_GLFWwindow* window)
|
|
|
|
{
|
|
|
|
return GLFW_FALSE;
|
2016-08-30 22:53:19 +00:00
|
|
|
}
|
|
|
|
|
2016-12-06 15:11:38 +00:00
|
|
|
void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformShowWindow(_GLFWwindow* window)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2017-03-21 13:02:57 +00:00
|
|
|
|
|
|
|
void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformUnhideWindow(_GLFWwindow* window)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformHideWindow(_GLFWwindow* window)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformFocusWindow(_GLFWwindow* window)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
int _glfwPlatformWindowFocused(_GLFWwindow* window)
|
|
|
|
{
|
|
|
|
return GLFW_FALSE;
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
int _glfwPlatformWindowIconified(_GLFWwindow* window)
|
|
|
|
{
|
|
|
|
return GLFW_FALSE;
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
int _glfwPlatformWindowVisible(_GLFWwindow* window)
|
|
|
|
{
|
|
|
|
return GLFW_FALSE;
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformPollEvents(void)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformWaitEvents(void)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformWaitEventsTimeout(double timeout)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformPostEmptyEvent(void)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformGetCursorPos(_GLFWwindow* window, double* xpos, double* ypos)
|
|
|
|
{
|
2016-08-30 22:53:19 +00:00
|
|
|
}
|
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
|
|
|
const GLFWimage* image,
|
2016-08-30 22:53:19 +00:00
|
|
|
int xhot, int yhot)
|
|
|
|
{
|
2016-11-08 23:23:19 +00:00
|
|
|
return GLFW_TRUE;
|
2016-08-30 22:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape)
|
|
|
|
{
|
2016-11-08 23:23:19 +00:00
|
|
|
return GLFW_TRUE;
|
2016-08-30 22:53:19 +00:00
|
|
|
}
|
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformDestroyCursor(_GLFWcursor* cursor)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
|
|
|
{
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
|
|
|
const char* _glfwPlatformGetClipboardString(_GLFWwindow* window)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-07-11 21:00:17 +00:00
|
|
|
const char* _glfwPlatformGetScancodeName(int scancode)
|
2016-10-13 15:24:51 +00:00
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
2016-08-30 22:53:19 +00:00
|
|
|
|
2016-10-13 15:24:51 +00:00
|
|
|
int _glfwPlatformGetKeyScancode(int key)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void _glfwPlatformGetRequiredInstanceExtensions(char** extensions)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-08-30 22:53:19 +00:00
|
|
|
int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
|
|
|
|
VkPhysicalDevice device,
|
|
|
|
uint32_t queuefamily)
|
|
|
|
{
|
|
|
|
return GLFW_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
|
|
|
|
_GLFWwindow* window,
|
|
|
|
const VkAllocationCallbacks* allocator,
|
|
|
|
VkSurfaceKHR* surface)
|
|
|
|
{
|
2016-10-13 15:24:51 +00:00
|
|
|
// This seems like the most appropriate error to return here
|
2016-08-30 22:53:19 +00:00
|
|
|
return VK_ERROR_INITIALIZATION_FAILED;
|
|
|
|
}
|
|
|
|
|