Added glfwGetVersionString.

This commit is contained in:
Camilla Berglund 2010-09-13 18:05:59 +02:00
parent 3c2a89e5e8
commit d6fe447ca9
6 changed files with 47 additions and 3 deletions

View File

@ -399,6 +399,7 @@ typedef void (* GLFWcharfun)(GLFWwindow,int);
GLFWAPI int glfwInit(void);
GLFWAPI void glfwTerminate(void);
GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
GLFWAPI const char* glfwGetVersionString(void);
/* Error handling */
GLFWAPI int glfwGetError(void);

View File

@ -266,6 +266,7 @@ version of GLFW.</p>
<li>Added <code>glfwMakeWindowCurrent</code> function for making the context of the specified window current</li>
<li>Added <code>glfwGetError</code> and <code>glfwErrorString</code> error reporting functions and a number of error tokens</li>
<li>Added <code>glfwSetWindowUserPointer</code> and <code>glfwGetWindowUserPointer</code> functions for per-window user pointers</li>
<li>Added <code>glfwGetVersionString</code> function for determining which code paths were enabled at compile time</li>
<li>Added <code>windows</code> simple multi-window test program</li>
<li>Changed buffer bit depth parameters of <code>glfwOpenWindow</code> to window hints</li>
<li>Renamed <code>lib</code> source code directory to <code>src</code></li>

View File

@ -97,3 +97,13 @@ GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev)
*rev = GLFW_VERSION_REVISION;
}
//========================================================================
// Get the GLFW version string
//========================================================================
GLFWAPI const char* glfwGetVersionString(void)
{
return _glfwPlatformGetVersionString();
}

View File

@ -235,9 +235,7 @@ GLFWGLOBAL _GLFWlibrary _glfwLibrary;
// Init/terminate
int _glfwPlatformInit(void);
int _glfwPlatformTerminate(void);
// Error handling
void _glfwSetError(int error);
const char* _glfwPlatformGetVersionString(void);
// Enable/Disable
void _glfwPlatformEnableSystemKeys(_GLFWwindow* window);
@ -285,6 +283,9 @@ void* _glfwPlatformGetProcAddress(const char* procname);
// Prototypes for platform independent internal functions
//========================================================================
// Error handling
void _glfwSetError(int error);
// Window management (window.c)
void _glfwClearWindowHints(void);

View File

@ -12,3 +12,5 @@
/* Define this to 1 if glXGetProcAddressEXT is available */
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESSEXT 1
#define _GLFW_VERSION_FULL "@GLFW_VERSION_FULL@"

View File

@ -247,3 +247,32 @@ int _glfwPlatformTerminate(void)
return GL_TRUE;
}
//========================================================================
// Get the GLFW version string
//========================================================================
const char* _glfwPlatformGetVersionString(void)
{
const char* version = "GLFW " _GLFW_VERSION_FULL
#if defined(_GLFW_HAS_XRANDR)
" XRandR"
#elif defined(_GLFW_HAS_XF86VIDMODE)
" Xf86VidMode"
#endif
#if defined(_GLFW_HAS_GLXGETPROCADDRESS)
" glXGetProcAddress"
#elif defined(_GLFW_HAS_GLXGETPROCADDRESSARB)
" glXGetProcAddressARB"
#elif defined(_GLFW_HAS_GLXGETPROCADDRESSEXT)
" glXGetProcAddressEXT"
#elif defined(_GLFW_DLOPEN_LIBGL)
" dlopen(libGL)"
#endif
#if defined(_GLFW_USE_LINUX_JOYSTICKS)
" Linux joystick API"
#endif
;
return version;
}