Made glfwGetVideoMode return a GLFWvidmode.

This commit is contained in:
Camilla Berglund 2013-01-05 22:07:06 +01:00
parent 9af960e2dd
commit 316ee1d77d
6 changed files with 10 additions and 19 deletions

View File

@ -1043,7 +1043,7 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
* @param[out] mode The current mode of the monitor. * @param[out] mode The current mode of the monitor.
* @ingroup monitor * @ingroup monitor
*/ */
GLFWAPI void glfwGetVideoMode(GLFWmonitor* monitor, GLFWvidmode* mode); GLFWAPI GLFWvidmode glfwGetVideoMode(GLFWmonitor* monitor);
/*! @brief Sets the system gamma ramp to one generated from the specified /*! @brief Sets the system gamma ramp to one generated from the specified
* exponent. * exponent.

View File

@ -476,22 +476,18 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count)
// Get the current video mode for the specified monitor // Get the current video mode for the specified monitor
//======================================================================== //========================================================================
GLFWAPI void glfwGetVideoMode(GLFWmonitor* handle, GLFWvidmode* mode) GLFWAPI GLFWvidmode glfwGetVideoMode(GLFWmonitor* handle)
{ {
_GLFWmonitor* monitor = (_GLFWmonitor*) handle; _GLFWmonitor* monitor = (_GLFWmonitor*) handle;
GLFWvidmode mode = { 0, 0, 0, 0, 0 };
if (!_glfwInitialized) if (!_glfwInitialized)
{ {
_glfwInputError(GLFW_NOT_INITIALIZED, NULL); _glfwInputError(GLFW_NOT_INITIALIZED, NULL);
return; return mode;
} }
if (mode == NULL) _glfwPlatformGetVideoMode(monitor, &mode);
{ return mode;
_glfwInputError(GLFW_INVALID_VALUE, NULL);
return;
}
_glfwPlatformGetVideoMode(monitor, mode);
} }

View File

@ -346,8 +346,7 @@ void monitor_callback(GLFWmonitor* monitor, int event)
{ {
if (event == GLFW_CONNECTED) if (event == GLFW_CONNECTED)
{ {
GLFWvidmode mode; GLFWvidmode mode = glfwGetVideoMode(monitor);
glfwGetVideoMode(monitor, &mode);
printf("%08x at %0.3f: Monitor %s (%ix%i at %ix%i, %ix%i mm) was connected\n", printf("%08x at %0.3f: Monitor %s (%ix%i at %ix%i, %ix%i mm) was connected\n",
counter++, counter++,

View File

@ -130,8 +130,7 @@ int main(int argc, char** argv)
if (monitor) if (monitor)
{ {
GLFWvidmode mode; GLFWvidmode mode = glfwGetVideoMode(monitor);
glfwGetVideoMode(monitor, &mode);
width = mode.width; width = mode.width;
height = mode.height; height = mode.height;
} }

View File

@ -125,8 +125,7 @@ int main(int argc, char** argv)
if (monitor) if (monitor)
{ {
GLFWvidmode mode; GLFWvidmode mode = glfwGetVideoMode(monitor);
glfwGetVideoMode(monitor, &mode);
width = mode.width; width = mode.width;
height = mode.height; height = mode.height;
} }

View File

@ -93,11 +93,9 @@ static void key_callback(GLFWwindow* window, int key, int action)
static void list_modes(GLFWmonitor* monitor) static void list_modes(GLFWmonitor* monitor)
{ {
int count, widthMM, heightMM, dpi, i; int count, widthMM, heightMM, dpi, i;
GLFWvidmode mode; GLFWvidmode mode = glfwGetVideoMode(monitor);
const GLFWvidmode* modes = glfwGetVideoModes(monitor, &count); const GLFWvidmode* modes = glfwGetVideoModes(monitor, &count);
glfwGetVideoMode(monitor, &mode);
printf("Name: %s (%s)\n", printf("Name: %s (%s)\n",
glfwGetMonitorName(monitor), glfwGetMonitorName(monitor),
glfwGetPrimaryMonitor() == monitor ? "primary" : "secondary"); glfwGetPrimaryMonitor() == monitor ? "primary" : "secondary");