Converted Cocoa port to new API.

This commit is contained in:
Camilla Berglund
2010-09-15 18:57:25 +02:00
parent 855b386e46
commit 26eb8e74c8
8 changed files with 367 additions and 442 deletions
+10 -12
View File
@@ -33,7 +33,7 @@
// Check whether the display mode should be included in enumeration
//========================================================================
static BOOL modeIsGood( NSDictionary *mode )
static BOOL modeIsGood(NSDictionary* mode)
{
// This is a bit controversial, if you've got something other than an
// LCD computer monitor as an output device you might not want these
@@ -50,7 +50,7 @@ static BOOL modeIsGood( NSDictionary *mode )
// Convert Core Graphics display mode to GLFW video mode
//========================================================================
static GLFWvidmode vidmodeFromCGDisplayMode( NSDictionary *mode )
static GLFWvidmode vidmodeFromCGDisplayMode(NSDictionary* mode)
{
unsigned int width = [[mode objectForKey:(id)kCGDisplayWidth] unsignedIntValue];
unsigned int height = [[mode objectForKey:(id)kCGDisplayHeight] unsignedIntValue];
@@ -74,18 +74,16 @@ static GLFWvidmode vidmodeFromCGDisplayMode( NSDictionary *mode )
// Get a list of available video modes
//========================================================================
int _glfwPlatformGetVideoModes( GLFWvidmode *list, int maxcount )
int _glfwPlatformGetVideoModes(GLFWvidmode* list, int maxcount)
{
NSArray *modes = (NSArray *)CGDisplayAvailableModes( CGMainDisplayID() );
NSArray* modes = (NSArray*) CGDisplayAvailableModes(CGMainDisplayID());
unsigned int i, j = 0, n = [modes count];
for( i = 0; i < n && i < (unsigned)maxcount; i++ )
for (i = 0; i < n && i < (unsigned)maxcount; i++)
{
NSDictionary *mode = [modes objectAtIndex:i];
if( modeIsGood( mode ) )
{
list[j++] = vidmodeFromCGDisplayMode( mode );
}
if (modeIsGood(mode))
list[j++] = vidmodeFromCGDisplayMode(mode);
}
return j;
@@ -95,8 +93,8 @@ int _glfwPlatformGetVideoModes( GLFWvidmode *list, int maxcount )
// Get the desktop video mode
//========================================================================
void _glfwPlatformGetDesktopMode( GLFWvidmode *mode )
void _glfwPlatformGetDesktopMode(GLFWvidmode *mode)
{
*mode = vidmodeFromCGDisplayMode( _glfwLibrary.DesktopMode );
*mode = vidmodeFromCGDisplayMode(_glfwLibrary.NS.desktopMode);
}