diff options
Diffstat (limited to 'pugl')
-rw-r--r-- | pugl/detail/implementation.c | 19 | ||||
-rw-r--r-- | pugl/pugl.h | 7 |
2 files changed, 26 insertions, 0 deletions
diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c index 80a7a32..a2ff2ec 100644 --- a/pugl/detail/implementation.c +++ b/pugl/detail/implementation.c @@ -25,6 +25,25 @@ #include <stdlib.h> #include <string.h> +const char* +puglStrerror(const PuglStatus status) +{ + switch (status) { + case PUGL_SUCCESS: return "Success"; + case PUGL_FAILURE: return "Non-fatal failure"; + case PUGL_UNKNOWN_ERROR: return "Unknown system error"; + case PUGL_BAD_BACKEND: return "Invalid or missing backend"; + case PUGL_BACKEND_FAILED: return "Backend initialisation failed"; + case PUGL_REGISTRATION_FAILED: return "Window class registration failed"; + case PUGL_CREATE_WINDOW_FAILED: return "Window creation failed"; + case PUGL_SET_FORMAT_FAILED: return "Failed to set pixel format"; + case PUGL_CREATE_CONTEXT_FAILED: return "Failed to create drawing context"; + case PUGL_UNSUPPORTED_TYPE: return "Unsupported data type"; + } + + return "Unknown error"; +} + void puglSetString(char** dest, const char* string) { diff --git a/pugl/pugl.h b/pugl/pugl.h index f08925f..0232d86 100644 --- a/pugl/pugl.h +++ b/pugl/pugl.h @@ -410,6 +410,13 @@ typedef union { } PuglEvent; /** + Return a string describing a status code. +*/ +PUGL_API +const char* +puglStrerror(PuglStatus status); + +/** @anchor world @name World The top level context of a Pugl application. |