mirror of
https://github.com/glfw/glfw.git
synced 2025-02-28 13:52:54 +00:00
Added switch
This commit is contained in:
parent
d18408516c
commit
5562aa575b
67
src/init.c
67
src/init.c
@ -150,26 +150,18 @@ char* _glfw_strdup(const char* source)
|
|||||||
|
|
||||||
float _glfw_fminf(float a, float b)
|
float _glfw_fminf(float a, float b)
|
||||||
{
|
{
|
||||||
if (a != a)
|
if (b != b || a < b)
|
||||||
return b;
|
|
||||||
else if (b != b)
|
|
||||||
return a;
|
return a;
|
||||||
else if (a < b)
|
|
||||||
return a;
|
return b;
|
||||||
else
|
|
||||||
return b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float _glfw_fmaxf(float a, float b)
|
float _glfw_fmaxf(float a, float b)
|
||||||
{
|
{
|
||||||
if (a != a)
|
if (b != b || a > b)
|
||||||
return b;
|
|
||||||
else if (b != b)
|
|
||||||
return a;
|
return a;
|
||||||
else if (a > b)
|
|
||||||
return a;
|
return b;
|
||||||
else
|
|
||||||
return b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void* _glfw_calloc(size_t count, size_t size)
|
void* _glfw_calloc(size_t count, size_t size)
|
||||||
@ -249,36 +241,53 @@ void _glfwInputError(int code, const char* format, ...)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (code == GLFW_NOT_INITIALIZED)
|
switch (code)
|
||||||
|
{
|
||||||
|
case GLFW_NOT_INITIALIZED:
|
||||||
strcpy(description, "The GLFW library is not initialized");
|
strcpy(description, "The GLFW library is not initialized");
|
||||||
else if (code == GLFW_NO_CURRENT_CONTEXT)
|
break;
|
||||||
|
case GLFW_NO_CURRENT_CONTEXT:
|
||||||
strcpy(description, "There is no current context");
|
strcpy(description, "There is no current context");
|
||||||
else if (code == GLFW_INVALID_ENUM)
|
break;
|
||||||
|
case GLFW_INVALID_ENUM:
|
||||||
strcpy(description, "Invalid argument for enum parameter");
|
strcpy(description, "Invalid argument for enum parameter");
|
||||||
else if (code == GLFW_INVALID_VALUE)
|
break;
|
||||||
|
case GLFW_INVALID_VALUE:
|
||||||
strcpy(description, "Invalid value for parameter");
|
strcpy(description, "Invalid value for parameter");
|
||||||
else if (code == GLFW_OUT_OF_MEMORY)
|
break;
|
||||||
|
case GLFW_OUT_OF_MEMORY:
|
||||||
strcpy(description, "Out of memory");
|
strcpy(description, "Out of memory");
|
||||||
else if (code == GLFW_API_UNAVAILABLE)
|
break;
|
||||||
|
case GLFW_API_UNAVAILABLE:
|
||||||
strcpy(description, "The requested API is unavailable");
|
strcpy(description, "The requested API is unavailable");
|
||||||
else if (code == GLFW_VERSION_UNAVAILABLE)
|
break;
|
||||||
|
case GLFW_VERSION_UNAVAILABLE:
|
||||||
strcpy(description, "The requested API version is unavailable");
|
strcpy(description, "The requested API version is unavailable");
|
||||||
else if (code == GLFW_PLATFORM_ERROR)
|
break;
|
||||||
|
case GLFW_PLATFORM_ERROR:
|
||||||
strcpy(description, "A platform-specific error occurred");
|
strcpy(description, "A platform-specific error occurred");
|
||||||
else if (code == GLFW_FORMAT_UNAVAILABLE)
|
break;
|
||||||
|
case GLFW_FORMAT_UNAVAILABLE:
|
||||||
strcpy(description, "The requested format is unavailable");
|
strcpy(description, "The requested format is unavailable");
|
||||||
else if (code == GLFW_NO_WINDOW_CONTEXT)
|
break;
|
||||||
|
case GLFW_NO_WINDOW_CONTEXT:
|
||||||
strcpy(description, "The specified window has no context");
|
strcpy(description, "The specified window has no context");
|
||||||
else if (code == GLFW_CURSOR_UNAVAILABLE)
|
break;
|
||||||
|
case GLFW_CURSOR_UNAVAILABLE:
|
||||||
strcpy(description, "The specified cursor shape is unavailable");
|
strcpy(description, "The specified cursor shape is unavailable");
|
||||||
else if (code == GLFW_FEATURE_UNAVAILABLE)
|
break;
|
||||||
|
case GLFW_FEATURE_UNAVAILABLE:
|
||||||
strcpy(description, "The requested feature cannot be implemented for this platform");
|
strcpy(description, "The requested feature cannot be implemented for this platform");
|
||||||
else if (code == GLFW_FEATURE_UNIMPLEMENTED)
|
break;
|
||||||
|
case GLFW_FEATURE_UNIMPLEMENTED:
|
||||||
strcpy(description, "The requested feature has not yet been implemented for this platform");
|
strcpy(description, "The requested feature has not yet been implemented for this platform");
|
||||||
else if (code == GLFW_PLATFORM_UNAVAILABLE)
|
break;
|
||||||
|
case GLFW_PLATFORM_UNAVAILABLE:
|
||||||
strcpy(description, "The requested platform is unavailable");
|
strcpy(description, "The requested platform is unavailable");
|
||||||
else
|
break;
|
||||||
|
default:
|
||||||
strcpy(description, "ERROR: UNKNOWN GLFW ERROR");
|
strcpy(description, "ERROR: UNKNOWN GLFW ERROR");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_glfw.initialized)
|
if (_glfw.initialized)
|
||||||
|
Loading…
Reference in New Issue
Block a user