mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-23 10:48:51 -05:00
Cleanup.
This commit is contained in:
parent
7b7ef1e07b
commit
1ffd8f667f
|
@ -111,8 +111,6 @@ int _glfwPlatformInit(void)
|
||||||
|
|
||||||
void _glfwPlatformTerminate(void)
|
void _glfwPlatformTerminate(void)
|
||||||
{
|
{
|
||||||
// TODO: Probably other cleanup
|
|
||||||
|
|
||||||
if (_glfw.ns.eventSource)
|
if (_glfw.ns.eventSource)
|
||||||
{
|
{
|
||||||
CFRelease(_glfw.ns.eventSource);
|
CFRelease(_glfw.ns.eventSource);
|
||||||
|
|
|
@ -444,10 +444,7 @@ void _glfwTerminateJoysticks(void)
|
||||||
int _glfwPlatformGetJoystickParam(int joy, int param)
|
int _glfwPlatformGetJoystickParam(int joy, int param)
|
||||||
{
|
{
|
||||||
if (!_glfw.ns.joysticks[joy].present)
|
if (!_glfw.ns.joysticks[joy].present)
|
||||||
{
|
|
||||||
// TODO: Figure out if this is an error
|
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
switch (param)
|
switch (param)
|
||||||
{
|
{
|
||||||
|
@ -478,10 +475,7 @@ int _glfwPlatformGetJoystickAxes(int joy, float* axes, int numaxes)
|
||||||
_GLFWjoy joystick = _glfw.ns.joysticks[joy];
|
_GLFWjoy joystick = _glfw.ns.joysticks[joy];
|
||||||
|
|
||||||
if (!joystick.present)
|
if (!joystick.present)
|
||||||
{
|
|
||||||
// TODO: Figure out if this is an error
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
numaxes = numaxes < joystick.numAxes ? numaxes : joystick.numAxes;
|
numaxes = numaxes < joystick.numAxes ? numaxes : joystick.numAxes;
|
||||||
|
|
||||||
|
@ -518,10 +512,7 @@ int _glfwPlatformGetJoystickButtons(int joy, unsigned char* buttons,
|
||||||
_GLFWjoy joystick = _glfw.ns.joysticks[joy];
|
_GLFWjoy joystick = _glfw.ns.joysticks[joy];
|
||||||
|
|
||||||
if (!joystick.present)
|
if (!joystick.present)
|
||||||
{
|
|
||||||
// TODO: Figure out if this is an error
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
// Update joystick state
|
// Update joystick state
|
||||||
pollJoystickEvents();
|
pollJoystickEvents();
|
||||||
|
|
|
@ -794,8 +794,6 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
||||||
|
|
||||||
[window->ns.object close];
|
[window->ns.object close];
|
||||||
window->ns.object = nil;
|
window->ns.object = nil;
|
||||||
|
|
||||||
// TODO: Probably more cleanup
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char *title)
|
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char *title)
|
||||||
|
|
|
@ -345,8 +345,6 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||||
|
|
||||||
if (window->egl.context == EGL_NO_CONTEXT)
|
if (window->egl.context == EGL_NO_CONTEXT)
|
||||||
{
|
{
|
||||||
// TODO: Handle all the various error codes here
|
|
||||||
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
"EGL: Failed to create context: %s",
|
"EGL: Failed to create context: %s",
|
||||||
getErrorString(eglGetError()));
|
getErrorString(eglGetError()));
|
||||||
|
|
|
@ -671,11 +671,8 @@ static void getFullWindowSize(_GLFWwindow* window,
|
||||||
int* fullWidth, int* fullHeight)
|
int* fullWidth, int* fullHeight)
|
||||||
{
|
{
|
||||||
RECT rect = { 0, 0, clientWidth, clientHeight };
|
RECT rect = { 0, 0, clientWidth, clientHeight };
|
||||||
|
AdjustWindowRectEx(&rect, window->win32.dwStyle,
|
||||||
// Adjust according to window styles
|
FALSE, window->win32.dwExStyle);
|
||||||
AdjustWindowRectEx(&rect, window->win32.dwStyle, FALSE, window->win32.dwExStyle);
|
|
||||||
|
|
||||||
// Calculate width and height of full window
|
|
||||||
*fullWidth = rect.right - rect.left;
|
*fullWidth = rect.right - rect.left;
|
||||||
*fullHeight = rect.bottom - rect.top;
|
*fullHeight = rect.bottom - rect.top;
|
||||||
}
|
}
|
||||||
|
@ -688,21 +685,21 @@ static ATOM registerWindowClass(void)
|
||||||
ATOM classAtom;
|
ATOM classAtom;
|
||||||
|
|
||||||
// Set window class parameters
|
// Set window class parameters
|
||||||
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Redraw on...
|
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
|
||||||
wc.lpfnWndProc = (WNDPROC) windowProc; // Message handler
|
wc.lpfnWndProc = (WNDPROC) windowProc;
|
||||||
wc.cbClsExtra = 0; // No extra class data
|
wc.cbClsExtra = 0; // No extra class data
|
||||||
wc.cbWndExtra = sizeof(void*) + sizeof(int); // Make room for one pointer
|
wc.cbWndExtra = sizeof(void*) + sizeof(int); // Make room for one pointer
|
||||||
wc.hInstance = GetModuleHandle(NULL); // Set instance
|
wc.hInstance = GetModuleHandle(NULL);
|
||||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW); // Load arrow pointer
|
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
wc.hbrBackground = NULL; // No background
|
wc.hbrBackground = NULL; // No background
|
||||||
wc.lpszMenuName = NULL; // No menu
|
wc.lpszMenuName = NULL; // No menu
|
||||||
wc.lpszClassName = _GLFW_WNDCLASSNAME; // Set class name
|
wc.lpszClassName = _GLFW_WNDCLASSNAME;
|
||||||
|
|
||||||
// Load user-provided icon if available
|
// Load user-provided icon if available
|
||||||
wc.hIcon = LoadIcon(GetModuleHandle(NULL), L"GLFW_ICON");
|
wc.hIcon = LoadIcon(GetModuleHandle(NULL), L"GLFW_ICON");
|
||||||
if (!wc.hIcon)
|
if (!wc.hIcon)
|
||||||
{
|
{
|
||||||
// User-provided icon not found; load default icon
|
// No user-provided icon found, load default icon
|
||||||
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
|
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,7 +732,6 @@ static int createWindow(_GLFWwindow* window,
|
||||||
window->win32.dwStyle |= WS_POPUP;
|
window->win32.dwStyle |= WS_POPUP;
|
||||||
|
|
||||||
_glfwPlatformGetMonitorPos(wndconfig->monitor, &xpos, &ypos);
|
_glfwPlatformGetMonitorPos(wndconfig->monitor, &xpos, &ypos);
|
||||||
|
|
||||||
fullWidth = wndconfig->width;
|
fullWidth = wndconfig->width;
|
||||||
fullHeight = wndconfig->height;
|
fullHeight = wndconfig->height;
|
||||||
}
|
}
|
||||||
|
@ -782,7 +778,7 @@ static int createWindow(_GLFWwindow* window,
|
||||||
NULL, // No parent window
|
NULL, // No parent window
|
||||||
NULL, // No window menu
|
NULL, // No window menu
|
||||||
GetModuleHandle(NULL),
|
GetModuleHandle(NULL),
|
||||||
window); // Pass GLFW window to WM_CREATE
|
window); // Pass object to WM_CREATE
|
||||||
|
|
||||||
free(wideTitle);
|
free(wideTitle);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user