mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Made GLFWvidmode members camel case.
This commit is contained in:
parent
9a7166926c
commit
af10b06439
@ -28,8 +28,8 @@ int main( void )
|
|||||||
// Show desktop video mode
|
// Show desktop video mode
|
||||||
glfwGetDesktopMode( &dtmode );
|
glfwGetDesktopMode( &dtmode );
|
||||||
printf( "Desktop mode: %d x %d x %d\n\n",
|
printf( "Desktop mode: %d x %d x %d\n\n",
|
||||||
dtmode.Width, dtmode.Height, dtmode.RedBits +
|
dtmode.width, dtmode.height, dtmode.redBits +
|
||||||
dtmode.GreenBits + dtmode.BlueBits );
|
dtmode.greenBits + dtmode.blueBits );
|
||||||
|
|
||||||
// List available video modes
|
// List available video modes
|
||||||
modecount = glfwGetVideoModes( modes, MAX_NUM_MODES );
|
modecount = glfwGetVideoModes( modes, MAX_NUM_MODES );
|
||||||
@ -37,8 +37,8 @@ int main( void )
|
|||||||
for( i = 0; i < modecount; i ++ )
|
for( i = 0; i < modecount; i ++ )
|
||||||
{
|
{
|
||||||
printf( "%3d: %d x %d x %d\n", i,
|
printf( "%3d: %d x %d x %d\n", i,
|
||||||
modes[i].Width, modes[i].Height, modes[i].RedBits +
|
modes[i].width, modes[i].height, modes[i].redBits +
|
||||||
modes[i].GreenBits + modes[i].BlueBits );
|
modes[i].greenBits + modes[i].blueBits );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Terminate GLFW
|
// Terminate GLFW
|
||||||
|
@ -359,8 +359,8 @@ extern "C" {
|
|||||||
|
|
||||||
/* The video mode structure used by glfwGetVideoModes() */
|
/* The video mode structure used by glfwGetVideoModes() */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int Width, Height;
|
int width, height;
|
||||||
int RedBits, BlueBits, GreenBits;
|
int redBits, blueBits, greenBits;
|
||||||
} GLFWvidmode;
|
} GLFWvidmode;
|
||||||
|
|
||||||
/* Function pointer types */
|
/* Function pointer types */
|
||||||
|
@ -38,14 +38,14 @@
|
|||||||
static int _glfwVideoModesEqual( GLFWvidmode* first,
|
static int _glfwVideoModesEqual( GLFWvidmode* first,
|
||||||
GLFWvidmode* second )
|
GLFWvidmode* second )
|
||||||
{
|
{
|
||||||
if( first->Width != second->Width )
|
if( first->width != second->width )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if( first->Height != second->Height )
|
if( first->height != second->height )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if( first->RedBits + first->GreenBits + first->BlueBits !=
|
if( first->redBits + first->greenBits + first->blueBits !=
|
||||||
second->RedBits + second->GreenBits + second->BlueBits )
|
second->redBits + second->greenBits + second->blueBits )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -62,18 +62,18 @@ static void _glfwCGToGLFWVideoMode( CFDictionaryRef cgMode,
|
|||||||
|
|
||||||
CFNumberGetValue( CFDictionaryGetValue( cgMode, kCGDisplayWidth ),
|
CFNumberGetValue( CFDictionaryGetValue( cgMode, kCGDisplayWidth ),
|
||||||
kCFNumberIntType,
|
kCFNumberIntType,
|
||||||
&(glfwMode->Width) );
|
&(glfwMode->width) );
|
||||||
CFNumberGetValue( CFDictionaryGetValue( cgMode, kCGDisplayHeight ),
|
CFNumberGetValue( CFDictionaryGetValue( cgMode, kCGDisplayHeight ),
|
||||||
kCFNumberIntType,
|
kCFNumberIntType,
|
||||||
&(glfwMode->Height) );
|
&(glfwMode->height) );
|
||||||
|
|
||||||
CFNumberGetValue( CFDictionaryGetValue( cgMode, kCGDisplayBitsPerSample ),
|
CFNumberGetValue( CFDictionaryGetValue( cgMode, kCGDisplayBitsPerSample ),
|
||||||
kCFNumberIntType,
|
kCFNumberIntType,
|
||||||
&bitsPerSample );
|
&bitsPerSample );
|
||||||
|
|
||||||
glfwMode->RedBits = bitsPerSample;
|
glfwMode->redBits = bitsPerSample;
|
||||||
glfwMode->GreenBits = bitsPerSample;
|
glfwMode->greenBits = bitsPerSample;
|
||||||
glfwMode->BlueBits = bitsPerSample;
|
glfwMode->blueBits = bitsPerSample;
|
||||||
}
|
}
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -98,7 +98,7 @@ int _glfwPlatformGetVideoModes( GLFWvidmode *list, int maxcount )
|
|||||||
&mode );
|
&mode );
|
||||||
|
|
||||||
// Is it a valid mode? (only list depths >= 15 bpp)
|
// Is it a valid mode? (only list depths >= 15 bpp)
|
||||||
if( mode.RedBits + mode.GreenBits + mode.BlueBits < 15 )
|
if( mode.redBits + mode.greenBits + mode.blueBits < 15 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Check for duplicate of current mode in target list
|
// Check for duplicate of current mode in target list
|
||||||
|
@ -57,11 +57,11 @@ static GLFWvidmode vidmodeFromCGDisplayMode( NSDictionary *mode )
|
|||||||
unsigned int bps = [[mode objectForKey:(id)kCGDisplayBitsPerSample] unsignedIntValue];
|
unsigned int bps = [[mode objectForKey:(id)kCGDisplayBitsPerSample] unsignedIntValue];
|
||||||
|
|
||||||
GLFWvidmode result;
|
GLFWvidmode result;
|
||||||
result.Width = width;
|
result.width = width;
|
||||||
result.Height = height;
|
result.height = height;
|
||||||
result.RedBits = bps;
|
result.redBits = bps;
|
||||||
result.GreenBits = bps;
|
result.greenBits = bps;
|
||||||
result.BlueBits = bps;
|
result.blueBits = bps;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
// Get a list of available video modes
|
// Get a list of available video modes
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI int glfwGetVideoModes(GLFWvidmode *list, int maxcount)
|
GLFWAPI int glfwGetVideoModes(GLFWvidmode* list, int maxcount)
|
||||||
{
|
{
|
||||||
int count, i, swap, res1, res2, depth1, depth2;
|
int count, i, swap, res1, res2, depth1, depth2;
|
||||||
GLFWvidmode vm;
|
GLFWvidmode vm;
|
||||||
@ -56,11 +56,11 @@ GLFWAPI int glfwGetVideoModes(GLFWvidmode *list, int maxcount)
|
|||||||
swap = 0;
|
swap = 0;
|
||||||
for (i = 0; i < count - 1; i++)
|
for (i = 0; i < count - 1; i++)
|
||||||
{
|
{
|
||||||
res1 = list[i].Width*list[i].Height;
|
res1 = list[i].width*list[i].height;
|
||||||
depth1 = list[i].RedBits+list[i].GreenBits+list[i].BlueBits;
|
depth1 = list[i].redBits+list[i].greenBits+list[i].blueBits;
|
||||||
res2 = list[i + 1].Width*list[i + 1].Height;
|
res2 = list[i + 1].width*list[i + 1].height;
|
||||||
depth2 = list[i + 1].RedBits+list[i + 1].GreenBits+
|
depth2 = list[i + 1].redBits+list[i + 1].greenBits+
|
||||||
list[i + 1].BlueBits;
|
list[i + 1].blueBits;
|
||||||
|
|
||||||
if ((depth2 < depth1) || ((depth2 == depth1) && (res2 < res1)))
|
if ((depth2 < depth1) || ((depth2 == depth1) && (res2 < res1)))
|
||||||
{
|
{
|
||||||
@ -81,7 +81,7 @@ GLFWAPI int glfwGetVideoModes(GLFWvidmode *list, int maxcount)
|
|||||||
// Get the desktop video mode
|
// Get the desktop video mode
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
|
||||||
GLFWAPI void glfwGetDesktopMode(GLFWvidmode *mode)
|
GLFWAPI void glfwGetDesktopMode(GLFWvidmode* mode)
|
||||||
{
|
{
|
||||||
if (!_glfwInitialized || mode == NULL)
|
if (!_glfwInitialized || mode == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -258,9 +258,9 @@ int _glfwPlatformGetVideoModes( GLFWvidmode *list, int maxcount )
|
|||||||
for( i = 0; i < count; i ++ )
|
for( i = 0; i < count; i ++ )
|
||||||
{
|
{
|
||||||
// Mode "code" for already listed mode
|
// Mode "code" for already listed mode
|
||||||
bpp = list[i].RedBits + list[i].GreenBits +
|
bpp = list[i].redBits + list[i].greenBits +
|
||||||
list[i].BlueBits;
|
list[i].blueBits;
|
||||||
m2 = (bpp << 25) | (list[i].Width * list[i].Height);
|
m2 = (bpp << 25) | (list[i].width * list[i].height);
|
||||||
if( m1 <= m2 )
|
if( m1 <= m2 )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
@ -270,11 +270,11 @@ int _glfwPlatformGetVideoModes( GLFWvidmode *list, int maxcount )
|
|||||||
// New entry at the end of the list?
|
// New entry at the end of the list?
|
||||||
if( i >= count )
|
if( i >= count )
|
||||||
{
|
{
|
||||||
list[count].Width = dm.dmPelsWidth;
|
list[count].width = dm.dmPelsWidth;
|
||||||
list[count].Height = dm.dmPelsHeight;
|
list[count].height = dm.dmPelsHeight;
|
||||||
list[count].RedBits = r;
|
list[count].redBits = r;
|
||||||
list[count].GreenBits = g;
|
list[count].greenBits = g;
|
||||||
list[count].BlueBits = b;
|
list[count].blueBits = b;
|
||||||
count ++;
|
count ++;
|
||||||
}
|
}
|
||||||
// Insert new entry in the list?
|
// Insert new entry in the list?
|
||||||
@ -284,11 +284,11 @@ int _glfwPlatformGetVideoModes( GLFWvidmode *list, int maxcount )
|
|||||||
{
|
{
|
||||||
list[j] = list[j-1];
|
list[j] = list[j-1];
|
||||||
}
|
}
|
||||||
list[i].Width = dm.dmPelsWidth;
|
list[i].width = dm.dmPelsWidth;
|
||||||
list[i].Height = dm.dmPelsHeight;
|
list[i].height = dm.dmPelsHeight;
|
||||||
list[i].RedBits = r;
|
list[i].redBits = r;
|
||||||
list[i].GreenBits = g;
|
list[i].greenBits = g;
|
||||||
list[i].BlueBits = b;
|
list[i].blueBits = b;
|
||||||
count ++;
|
count ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,8 +313,8 @@ void _glfwPlatformGetDesktopMode( GLFWvidmode *mode )
|
|||||||
(void) EnumDisplaySettings( NULL, ENUM_REGISTRY_SETTINGS, &dm );
|
(void) EnumDisplaySettings( NULL, ENUM_REGISTRY_SETTINGS, &dm );
|
||||||
|
|
||||||
// Return desktop mode parameters
|
// Return desktop mode parameters
|
||||||
mode->Width = dm.dmPelsWidth;
|
mode->width = dm.dmPelsWidth;
|
||||||
mode->Height = dm.dmPelsHeight;
|
mode->height = dm.dmPelsHeight;
|
||||||
bpp2rgb( dm.dmBitsPerPel, &mode->RedBits, &mode->GreenBits, &mode->BlueBits );
|
bpp2rgb( dm.dmBitsPerPel, &mode->redBits, &mode->greenBits, &mode->blueBits );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,11 +471,11 @@ int _glfwPlatformGetVideoModes(GLFWvidmode* list, int maxcount)
|
|||||||
{
|
{
|
||||||
for (l = 0; l < rescount && count < maxcount; l++)
|
for (l = 0; l < rescount && count < maxcount; l++)
|
||||||
{
|
{
|
||||||
list[count].Width = resarray[l].width;
|
list[count].width = resarray[l].width;
|
||||||
list[count].Height = resarray[l].height;
|
list[count].height = resarray[l].height;
|
||||||
list[count].RedBits = (rgbarray[k] >> 16) & 255;
|
list[count].redBits = (rgbarray[k] >> 16) & 255;
|
||||||
list[count].GreenBits = (rgbarray[k] >> 8) & 255;
|
list[count].greenBits = (rgbarray[k] >> 8) & 255;
|
||||||
list[count].BlueBits = rgbarray[k] & 255;
|
list[count].blueBits = rgbarray[k] & 255;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -511,15 +511,15 @@ void _glfwPlatformGetDesktopMode(GLFWvidmode* mode)
|
|||||||
bpp = DefaultDepth(dpy, screen);
|
bpp = DefaultDepth(dpy, screen);
|
||||||
|
|
||||||
// Convert BPP to RGB bits
|
// Convert BPP to RGB bits
|
||||||
BPP2RGB(bpp, &mode->RedBits, &mode->GreenBits, &mode->BlueBits);
|
BPP2RGB(bpp, &mode->redBits, &mode->greenBits, &mode->blueBits);
|
||||||
|
|
||||||
#if defined(_GLFW_HAS_XRANDR)
|
#if defined(_GLFW_HAS_XRANDR)
|
||||||
if (_glfwLibrary.XRandR.available)
|
if (_glfwLibrary.XRandR.available)
|
||||||
{
|
{
|
||||||
if (_glfwWin.FS.modeChanged)
|
if (_glfwWin.FS.modeChanged)
|
||||||
{
|
{
|
||||||
mode->Width = _glfwWin.FS.oldWidth;
|
mode->width = _glfwWin.FS.oldWidth;
|
||||||
mode->Height = _glfwWin.FS.oldHeight;
|
mode->height = _glfwWin.FS.oldHeight;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -529,8 +529,8 @@ void _glfwPlatformGetDesktopMode(GLFWvidmode* mode)
|
|||||||
if (_glfwWin.FS.modeChanged)
|
if (_glfwWin.FS.modeChanged)
|
||||||
{
|
{
|
||||||
// The old (desktop) mode is stored in _glfwWin.FS.oldMode
|
// The old (desktop) mode is stored in _glfwWin.FS.oldMode
|
||||||
mode->Width = _glfwWin.FS.oldMode.hdisplay;
|
mode->width = _glfwWin.FS.oldMode.hdisplay;
|
||||||
mode->Height = _glfwWin.FS.oldMode.vdisplay;
|
mode->height = _glfwWin.FS.oldMode.vdisplay;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -538,8 +538,8 @@ void _glfwPlatformGetDesktopMode(GLFWvidmode* mode)
|
|||||||
XF86VidModeGetAllModeLines(dpy, screen, &modecount, &modelist);
|
XF86VidModeGetAllModeLines(dpy, screen, &modecount, &modelist);
|
||||||
|
|
||||||
// The first mode in the list is the current (desktio) mode
|
// The first mode in the list is the current (desktio) mode
|
||||||
mode->Width = modelist[0]->hdisplay;
|
mode->width = modelist[0]->hdisplay;
|
||||||
mode->Height = modelist[0]->vdisplay;
|
mode->height = modelist[0]->vdisplay;
|
||||||
|
|
||||||
// Free list
|
// Free list
|
||||||
XFree(modelist);
|
XFree(modelist);
|
||||||
@ -550,7 +550,7 @@ void _glfwPlatformGetDesktopMode(GLFWvidmode* mode)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Get current display width and height
|
// Get current display width and height
|
||||||
mode->Width = DisplayWidth(dpy, screen);
|
mode->width = DisplayWidth(dpy, screen);
|
||||||
mode->Height = DisplayHeight(dpy, screen);
|
mode->height = DisplayHeight(dpy, screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user