1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 02:38:52 -05:00

Reshuffling, formatting and shortening.

This commit is contained in:
Camilla Berglund 2011-10-06 23:28:56 +02:00
parent 29a4eca87d
commit 9738728298
13 changed files with 194 additions and 161 deletions

View File

@ -469,10 +469,22 @@ extern "C" {
/* Gamma ramps */
#define GLFW_GAMMA_RAMP_SIZE 256
/* Monitor constants */
#define GLFW_MONITOR_CONNECTED 0
#define GLFW_MONITOR_DISCONNECTED 1
#define GLFW_MONITOR_NAME 0
#define GLFW_MONITOR_PHYSICAL_WIDTH 1
#define GLFW_MONITOR_PHYSICAL_HEIGHT 2
#define GLFW_MONITOR_SCREEN_POS_X 3
#define GLFW_MONITOR_SCREEN_POS_Y 4
/*************************************************************************
* Typedefs
*************************************************************************/
/* Monitor handle type */
typedef void* GLFWmonitor;
/* Window handle type */
typedef void* GLFWwindow;
@ -490,6 +502,7 @@ typedef void (* GLFWkeyfun)(GLFWwindow,int,int);
typedef void (* GLFWcharfun)(GLFWwindow,int);
typedef void* (* GLFWmallocfun)(size_t);
typedef void (* GLFWfreefun)(void*);
typedef void (* GLFWmonitordevicefun)(GLFWmonitor,int);
/* The video mode structure used by glfwGetVideoModes */
typedef struct
@ -539,33 +552,18 @@ GLFWAPI int glfwGetError(void);
GLFWAPI const char* glfwErrorString(int error);
GLFWAPI void glfwSetErrorCallback(GLFWerrorfun cbfun);
/* Monitor constants */
#define GLFW_MONITOR_INVALID_HANDLE (NULL)
#define GLFW_MONITOR_CONNECTED 0
#define GLFW_MONITOR_DISCONNECTED 1
#define GLFW_MONITOR_PARAM_S_NAME 0
#define GLFW_MONITOR_PARAM_I_PHYS_WIDTH 1
#define GLFW_MONITOR_PARAM_I_PHYS_HEIGHT 2
#define GLFW_MONITOR_PARAM_I_SCREEN_X_POS 3
#define GLFW_MONITOR_PARAM_I_SCREEN_Y_POS 4
/* Monitor types */
typedef struct _GLFWmonitor* GLFWmonitor;
typedef void (* GLFWmonitordevicefun)(GLFWmonitor,int); /* connect / disconnect */
/* Monitor callback registration */
GLFWAPI void glfwSetMonitorDeviceCallback(GLFWmonitordevicefun cbfun);
/* Monitor attributes */
GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor monitor, void* pointer);
GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor monitor);
GLFWAPI int glfwGetMonitorIntegerParam(GLFWmonitor monitor, int param);
GLFWAPI const char* glfwGetMonitorStringParam(GLFWmonitor monitor, int param);
GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor monitor, void* pointer);
GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor monitor);
GLFWAPI int glfwGetMonitorParam(GLFWmonitor monitor, int param);
GLFWAPI const char* glfwGetMonitorString(GLFWmonitor monitor, int param);
/* Monitor discovery */
GLFWAPI GLFWmonitor glfwGetNextMonitor(GLFWmonitor iterator);
/* Video mode functions */
GLFWAPI int glfwGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxcount);
GLFWAPI void glfwGetDesktopMode(GLFWvidmode* mode);

View File

@ -1,4 +1,8 @@
if(WIN32)
add_definitions(-DWINVER=0x0501)
endif(WIN32)
if(CYGWIN)
# These lines are intended to remove the --export-all-symbols

View File

@ -100,9 +100,10 @@ void _glfwSplitBPP(int bpp, int* red, int* green, int* blue)
// Get a list of available video modes
//========================================================================
GLFWAPI int glfwGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxcount)
GLFWAPI int glfwGetVideoModes(GLFWmonitor handle, GLFWvidmode* list, int maxcount)
{
int count;
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
if (!_glfwInitialized)
{
@ -110,9 +111,10 @@ GLFWAPI int glfwGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxcou
return 0;
}
if (monitor == GLFW_MONITOR_INVALID_HANDLE)
if (monitor == NULL)
{
_glfwSetError(GLFW_INVALID_VALUE, "Monitor handle is invalid.");
_glfwSetError(GLFW_INVALID_VALUE,
"glfwGetVideoModes: Invalid monitor handle");
return 0;
}

View File

@ -225,13 +225,13 @@ struct _GLFWmonitor
void* userPointer;
char* deviceName;
char* name;
// physical dimensions in millimeters.
int physicalWidth;
int physicalHeight;
// logical orientation of the screen on the desktop
int screenXPosition;
int screenYPosition;
int screenX;
int screenY;
// These are defined in the current port's platform.h
_GLFW_PLATFORM_MONITOR_STATE;
@ -301,7 +301,7 @@ void _glfwPlatformEnableSystemKeys(_GLFWwindow* window);
void _glfwPlatformDisableSystemKeys(_GLFWwindow* window);
// Fullscreen
int _glfwPlatformGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxcount);
int _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, GLFWvidmode* list, int maxcount);
void _glfwPlatformGetDesktopMode(GLFWvidmode* mode);
// Gamma ramp

View File

@ -31,81 +31,102 @@
#include "internal.h"
//////////////////////////////////////////////////////////////////////////
////// GLFW public API //////
//////////////////////////////////////////////////////////////////////////
//========================================================================
// Get a list of connected monitors
// Iterate through connected monitors
//========================================================================
GLFWAPI GLFWmonitor glfwGetNextMonitor(GLFWmonitor iterator)
GLFWAPI GLFWmonitor glfwGetNextMonitor(GLFWmonitor handle)
{
GLFWmonitor result = GLFW_MONITOR_INVALID_HANDLE;
_GLFWmonitor* iterator = (_GLFWmonitor*) handle;
_GLFWmonitor* result = NULL;
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
return result;
}
if (iterator == GLFW_MONITOR_INVALID_HANDLE)
{
if (iterator == NULL)
result = _glfwLibrary.monitorListHead;
}
else
{
result = iterator->next;
}
return result;
}
GLFWAPI int glfwGetMonitorIntegerParam(GLFWmonitor monitor, int param)
//========================================================================
// Get monitor parameter
//========================================================================
GLFWAPI int glfwGetMonitorParam(GLFWmonitor handle, int param)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
return 0;
}
if (monitor == GLFW_MONITOR_INVALID_HANDLE)
if (monitor == NULL)
{
_glfwSetError(GLFW_INVALID_VALUE, "Monitor handle is invalid.");
_glfwSetError(GLFW_INVALID_VALUE,
"glfwGetMonitorParam: Invalid monitor handle");
return 0;
}
switch(param)
switch (param)
{
case GLFW_MONITOR_PARAM_I_PHYS_WIDTH:
case GLFW_MONITOR_PHYSICAL_WIDTH:
return monitor->physicalWidth;
case GLFW_MONITOR_PARAM_I_PHYS_HEIGHT:
case GLFW_MONITOR_PHYSICAL_HEIGHT:
return monitor->physicalHeight;
case GLFW_MONITOR_PARAM_I_SCREEN_X_POS:
return monitor->screenXPosition;
case GLFW_MONITOR_PARAM_I_SCREEN_Y_POS:
return monitor->screenYPosition;
default:
_glfwSetError(GLFW_INVALID_ENUM, "Param represents not a valid integer monitor attribute.");
return 0;
case GLFW_MONITOR_SCREEN_POS_X:
return monitor->screenX;
case GLFW_MONITOR_SCREEN_POS_Y:
return monitor->screenY;
}
_glfwSetError(GLFW_INVALID_ENUM,
"glfwGetMonitorParam: Invalid enum value for 'param' parameter");
return 0;
}
GLFWAPI const char* glfwGetMonitorStringParam(GLFWmonitor monitor, int param)
//========================================================================
// Get monitor string
//========================================================================
GLFWAPI const char* glfwGetMonitorString(GLFWmonitor handle, int param)
{
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
return NULL;
}
if (monitor == GLFW_MONITOR_INVALID_HANDLE)
if (monitor == NULL)
{
_glfwSetError(GLFW_INVALID_VALUE, "monitor handle is invalid.");
_glfwSetError(GLFW_INVALID_VALUE,
"glfwGetMonitorString: Invalid monitor handle");
return NULL;
}
switch(param)
switch (param)
{
case GLFW_MONITOR_PARAM_S_NAME:
return monitor->deviceName;
default:
_glfwSetError(GLFW_INVALID_ENUM, "Param represents not a valid string monitor attribute.");
return NULL;
case GLFW_MONITOR_NAME:
return monitor->name;
}
_glfwSetError(GLFW_INVALID_ENUM,
"glfwGetMonitorString: Invalid enum value for 'param' parameter");
return NULL;
}

View File

@ -182,7 +182,7 @@ void _glfwRestoreVideoMode(void)
// Get a list of available video modes
//========================================================================
int _glfwPlatformGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxcount)
int _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, GLFWvidmode* list, int maxcount)
{
DEVMODE deviceMode;
DWORD deviceModeNum;
@ -197,14 +197,18 @@ int _glfwPlatformGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxc
vidModes = NULL;
vidModesCount = 0;
while (EnumDisplaySettings(monitor->Win32.DeviceName, deviceModeNum, &deviceMode) && (!list || (vidModesCount < maxcount)))
for (;;)
{
if (!EnumDisplaySettings(monitor->Win32.name, deviceModeNum, &deviceMode))
break;
if (vidModesCount >= maxcount)
break;
deviceModeNum++;
if (deviceMode.dmBitsPerPel < 15)
{
continue;
}
vidMode.height = deviceMode.dmPelsHeight;
vidMode.width = deviceMode.dmPelsWidth;
@ -216,9 +220,7 @@ int _glfwPlatformGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxc
// skip duplicates.
if (vidModes && bsearch(&vidMode, vidModes, vidModesCount, sizeof(GLFWvidmode), _glfwCompareVideoModes))
{
continue;
}
vidModes = realloc(vidModes, sizeof(GLFWvidmode) * ++vidModesCount);
memcpy(vidModes + (vidModesCount - 1), &vidMode, sizeof(GLFWvidmode));
@ -227,9 +229,7 @@ int _glfwPlatformGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxc
}
if (list && maxcount)
{
memcpy(list, vidModes, sizeof(GLFWvidmode) * min(vidModesCount, maxcount));
}
free(vidModes);

View File

@ -33,12 +33,20 @@
#include <stdlib.h>
#include <string.h>
// The MinGW package for Debian lacks this
#ifndef EDS_ROTATEDMODE
#define EDS_ROTATEDMODE 0x00000004
#endif
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
_GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current, DISPLAY_DEVICE* adapter, DISPLAY_DEVICE* monitor, DEVMODE* setting)
_GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current,
DISPLAY_DEVICE* adapter,
DISPLAY_DEVICE* monitor,
DEVMODE* setting)
{
HDC dc = NULL;
@ -52,14 +60,14 @@ _GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current, DISPLAY_DEVICE* adapte
DeleteDC(dc);
(*current)->deviceName = _glfwMalloc(strlen(monitor->DeviceName) + 1);
memcpy((*current)->deviceName, monitor->DeviceName, strlen(monitor->DeviceName) + 1);
(*current)->deviceName[strlen(monitor->DeviceName)] = '\0';
(*current)->name = _glfwMalloc(strlen(monitor->DeviceName) + 1);
memcpy((*current)->name, monitor->DeviceName, strlen(monitor->DeviceName) + 1);
(*current)->name[strlen(monitor->DeviceName)] = '\0';
(*current)->screenXPosition = setting->dmPosition.x;
(*current)->screenYPosition = setting->dmPosition.y;
(*current)->screenX = setting->dmPosition.x;
(*current)->screenY = setting->dmPosition.y;
memcpy((*current)->Win32.DeviceName, adapter->DeviceName, 32);
memcpy((*current)->Win32.name, adapter->DeviceName, 32);
return &((*current)->next);
}
@ -69,7 +77,7 @@ _GLFWmonitor* _glfwDestroyMonitor(_GLFWmonitor* monitor)
result = monitor->next;
_glfwFree(monitor->deviceName);
_glfwFree(monitor->name);
_glfwFree(monitor);
return result;
@ -96,14 +104,15 @@ void _glfwInitMonitors(void)
setting.dmSize = sizeof(DEVMODE);
settingNum = 0;
while(EnumDisplayDevices(NULL, adapterNum++, &adapter, 0))
while (EnumDisplayDevices(NULL, adapterNum++, &adapter, 0))
{
if(adapter.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER)
{
if (adapter.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER)
continue;
}
EnumDisplaySettingsEx(adapter.DeviceName, ENUM_CURRENT_SETTINGS, &setting, EDS_ROTATEDMODE);
EnumDisplaySettingsEx(adapter.DeviceName,
ENUM_CURRENT_SETTINGS,
&setting,
EDS_ROTATEDMODE);
EnumDisplayDevices(adapter.DeviceName, 0, &monitor, 0);
@ -113,7 +122,7 @@ void _glfwInitMonitors(void)
void _glfwTerminateMonitors(void)
{
while(_glfwLibrary.monitorListHead)
while (_glfwLibrary.monitorListHead)
_glfwLibrary.monitorListHead = _glfwDestroyMonitor(_glfwLibrary.monitorListHead);
}

View File

@ -316,7 +316,8 @@ typedef struct _GLFWlibraryWin32
//------------------------------------------------------------------------
typedef struct _GLFWmonitorWin32
{
char DeviceName[32];
char name[32];
} _GLFWmonitorWin32;
//========================================================================

View File

@ -33,9 +33,6 @@
#include <stdio.h>
#include <stdlib.h>
void showMouseCursor(_GLFWwindow* window);
void captureMouseCursor(_GLFWwindow* window);
//========================================================================
// Convert BPP to RGB bits based on "best guess"
//========================================================================
@ -148,6 +145,48 @@ static void setForegroundWindow(HWND hWnd)
}
//========================================================================
// Hide mouse cursor (lock it)
//========================================================================
static void hideMouseCursor(_GLFWwindow* window)
{
ShowCursor(FALSE);
}
//========================================================================
// Show mouse cursor (unlock it)
//========================================================================
static void showMouseCursor(_GLFWwindow* window)
{
// Un-capture cursor
ReleaseCapture();
// Release the cursor from the window
ClipCursor(NULL);
ShowCursor(TRUE);
}
//========================================================================
// Capture mouse cursor
//========================================================================
static void captureMouseCursor(_GLFWwindow* window)
{
RECT ClipWindowRect;
// Clip cursor to the window
if (GetWindowRect(window->Win32.handle, &ClipWindowRect))
ClipCursor(&ClipWindowRect);
// Capture cursor to user window
SetCapture(window->Win32.handle);
}
//========================================================================
// Returns the specified attribute of the specified pixel format
// NOTE: Do not call this unless we have found WGL_ARB_pixel_format
@ -1848,50 +1887,6 @@ void _glfwPlatformWaitEvents(void)
}
//========================================================================
// Hide mouse cursor (lock it)
//========================================================================
void hideMouseCursor(_GLFWwindow* window)
{
ShowCursor(FALSE);
captureMouseCursor(window);
}
//========================================================================
// Show mouse cursor (unlock it)
//========================================================================
void showMouseCursor(_GLFWwindow* window)
{
// Un-capture cursor
ReleaseCapture();
// Release the cursor from the window
ClipCursor(NULL);
ShowCursor(TRUE);
}
//========================================================================
// Capture mouse cursor
//========================================================================
static void captureMouseCursor(_GLFWwindow* window)
{
RECT ClipWindowRect;
// Clip cursor to the window
if (GetWindowRect(window->Win32.handle, &ClipWindowRect))
ClipCursor(&ClipWindowRect);
// Capture cursor to user window
SetCapture(window->Win32.handle);
}
//========================================================================
// Set physical mouse cursor position
//========================================================================

View File

@ -344,7 +344,7 @@ int _glfwCompareResolution(const void* left, const void* right)
// List available video modes
//========================================================================
int _glfwPlatformGetVideoModes(GLFWmonitor monitor, GLFWvidmode* list, int maxcount)
int _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, GLFWvidmode* list, int maxcount)
{
int count, k, l, r, g, b, rgba, gl;
int depth, screen;

View File

@ -38,8 +38,9 @@
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
#if defined (_GLFW_HAS_XRANDR)
_GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current, XRROutputInfo* outputInfo, XRRCrtcInfo* crtcInfo)
_GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current,
XRROutputInfo* outputInfo,
XRRCrtcInfo* crtcInfo)
{
*current = _glfwMalloc(sizeof(_GLFWmonitor));
memset(*current, 0, sizeof(_GLFWmonitor));
@ -47,17 +48,16 @@ _GLFWmonitor** _glfwCreateMonitor(_GLFWmonitor** current, XRROutputInfo* outputI
(*current)->physicalWidth = outputInfo->mm_width;
(*current)->physicalHeight = outputInfo->mm_height;
(*current)->deviceName = _glfwMalloc(strlen(outputInfo->name) + 1);
memcpy((*current)->deviceName, outputInfo->name, strlen(outputInfo->name) + 1);
(*current)->deviceName[strlen(outputInfo->name)] = '\0';
(*current)->name = _glfwMalloc(strlen(outputInfo->name) + 1);
memcpy((*current)->name, outputInfo->name, strlen(outputInfo->name) + 1);
(*current)->name[strlen(outputInfo->name)] = '\0';
(*current)->screenXPosition = crtcInfo->x;
(*current)->screenYPosition = crtcInfo->y;
(*current)->screenX = crtcInfo->x;
(*current)->screenY = crtcInfo->y;
(*current)->X11.output = outputInfo;
return &((*current)->next);
}
#endif /*_GLFW_HAS_XRANDR*/
_GLFWmonitor* _glfwDestroyMonitor(_GLFWmonitor* monitor)
{
@ -69,7 +69,7 @@ _GLFWmonitor* _glfwDestroyMonitor(_GLFWmonitor* monitor)
XRRFreeOutputInfo(monitor->X11.output);
#endif /*_GLFW_HAS_XRANDR*/
_glfwFree(monitor->deviceName);
_glfwFree(monitor->name);
_glfwFree(monitor);
return result;
@ -79,7 +79,7 @@ void _glfwInitMonitors(void)
{
_glfwLibrary.monitorListHead = NULL;
if(_glfwLibrary.X11.RandR.available == GL_TRUE)
if (_glfwLibrary.X11.RandR.available)
{
#if defined (_GLFW_HAS_XRANDR)
XRRScreenResources* resources;
@ -91,7 +91,7 @@ void _glfwInitMonitors(void)
resources = XRRGetScreenResources(_glfwLibrary.X11.display,
_glfwLibrary.X11.root);
for(outputIDX = 0; outputIDX < resources->noutput; outputIDX++)
for (outputIDX = 0; outputIDX < resources->noutput; outputIDX++)
{
// physical device
XRROutputInfo* outputInfo = NULL;
@ -103,11 +103,11 @@ void _glfwInitMonitors(void)
resources,
resources->outputs[outputIDX]);
if(outputInfo->connection == RR_Connected)
if (outputInfo->connection == RR_Connected)
{
for(crtcIDX = 0; crtcIDX < outputInfo->ncrtc; crtcIDX++)
for (crtcIDX = 0; crtcIDX < outputInfo->ncrtc; crtcIDX++)
{
if(outputInfo->crtc == outputInfo->crtcs[crtcIDX])
if (outputInfo->crtc == outputInfo->crtcs[crtcIDX])
{
crtcInfo = XRRGetCrtcInfo(_glfwLibrary.X11.display,
resources,
@ -128,7 +128,7 @@ void _glfwInitMonitors(void)
void _glfwTerminateMonitors(void)
{
while(_glfwLibrary.monitorListHead)
while (_glfwLibrary.monitorListHead)
_glfwLibrary.monitorListHead = _glfwDestroyMonitor(_glfwLibrary.monitorListHead);
}

View File

@ -252,8 +252,10 @@ typedef struct _GLFWmonitorX11
{
#if defined(_GLFW_HAS_XRANDR)
XRROutputInfo* output;
#endif /*_GLFW_HAS_XRANDR*/
#else
int dummy;
#endif /*_GLFW_HAS_XRANDR*/
} _GLFWmonitorX11;

View File

@ -18,7 +18,7 @@ static void print_mode(GLFWvidmode* mode)
int main(void)
{
GLFWmonitor monitorHandle;
GLFWmonitor monitor;
GLFWvidmode dtmode, modes[400];
int modecount, i;
@ -33,29 +33,30 @@ int main(void)
printf("Desktop mode: ");
print_mode(&dtmode);
monitorHandle = GLFW_MONITOR_INVALID_HANDLE;
monitor = NULL;
while( GLFW_MONITOR_INVALID_HANDLE != ( monitorHandle = glfwGetNextMonitor( monitorHandle )))
while ((monitor = glfwGetNextMonitor(monitor)))
{
printf( "Monitor name: %s\n"
"Physical dimensions: %dmm x %dmm\n"
"Logical position: (%d,%d)\n",
glfwGetMonitorStringParam( monitorHandle, GLFW_MONITOR_PARAM_S_NAME ),
glfwGetMonitorIntegerParam( monitorHandle, GLFW_MONITOR_PARAM_I_PHYS_WIDTH ),
glfwGetMonitorIntegerParam( monitorHandle, GLFW_MONITOR_PARAM_I_PHYS_HEIGHT ),
glfwGetMonitorIntegerParam( monitorHandle, GLFW_MONITOR_PARAM_I_SCREEN_X_POS ),
glfwGetMonitorIntegerParam( monitorHandle, GLFW_MONITOR_PARAM_I_SCREEN_Y_POS )
);
printf("Monitor name: %s\n"
"Physical dimensions: %dmm x %dmm\n"
"Logical position: (%d,%d)\n",
glfwGetMonitorString(monitor, GLFW_MONITOR_NAME),
glfwGetMonitorParam(monitor, GLFW_MONITOR_PHYSICAL_WIDTH),
glfwGetMonitorParam(monitor, GLFW_MONITOR_PHYSICAL_HEIGHT),
glfwGetMonitorParam(monitor, GLFW_MONITOR_SCREEN_POS_X),
glfwGetMonitorParam(monitor, GLFW_MONITOR_SCREEN_POS_Y));
// List available video modes
modecount = glfwGetVideoModes(monitorHandle, modes, sizeof(modes) / sizeof(GLFWvidmode));
printf( "Available modes:\n" );
for( i = 0; i < modecount; i ++ )
modecount = glfwGetVideoModes(monitor, modes, sizeof(modes) / sizeof(GLFWvidmode));
printf("Available modes:\n");
for (i = 0; i < modecount; i++)
{
printf("%3i: ", i);
print_mode(modes + i);
}
}
glfwTerminate();
exit(EXIT_SUCCESS);
}