Added code to get MacOSX desktop dimensions

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@737 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
markgrebe 2005-08-24 05:30:00 +00:00
parent 99946d59f6
commit 7f9ed70401
2 changed files with 24 additions and 5 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: FrameBuffer.cxx,v 1.61 2005-08-23 18:32:51 stephena Exp $ // $Id: FrameBuffer.cxx,v 1.62 2005-08-24 05:29:59 markgrebe Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -31,6 +31,12 @@
#include "Launcher.hxx" #include "Launcher.hxx"
#include "Debugger.hxx" #include "Debugger.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#ifdef MAC_OSX
extern "C" {
uInt16 macOSXDisplayWidth(void);
uInt16 macOSXDisplayHeight(void);
}
#endif
#include "stella.xpm" // The Stella icon #include "stella.xpm" // The Stella icon
@ -98,10 +104,12 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height,
#elif defined(WIN32) #elif defined(WIN32)
myDesktopDim.w = (uInt16) GetSystemMetrics(SM_CXSCREEN); myDesktopDim.w = (uInt16) GetSystemMetrics(SM_CXSCREEN);
myDesktopDim.h = (uInt16) GetSystemMetrics(SM_CYSCREEN); myDesktopDim.h = (uInt16) GetSystemMetrics(SM_CYSCREEN);
#elif defined(MAC_OSX)
// FIXME - add OSX Desktop code here (I don't think SDL supports it yet)
#endif #endif
} }
#if defined(MAC_OSX)
myDesktopDim.w = macOSXDisplayWidth();
myDesktopDim.h = macOSXDisplayHeight();
#endif
// Set fullscreen flag // Set fullscreen flag
mySDLFlags = myOSystem->settings().getBool("fullscreen") ? SDL_FULLSCREEN : 0; mySDLFlags = myOSystem->settings().getBool("fullscreen") ? SDL_FULLSCREEN : 0;

View File

@ -4,7 +4,7 @@
Feel free to customize this file to suit your needs Feel free to customize this file to suit your needs
*/ */
/* $Id: SDLMain.m,v 1.4 2005-05-28 21:06:41 markgrebe Exp $ */ /* $Id: SDLMain.m,v 1.5 2005-08-24 05:30:00 markgrebe Exp $ */
#import "SDL.h" #import "SDL.h"
#import "SDLMain.h" #import "SDLMain.h"
@ -23,6 +23,17 @@ static char startupFile[FILENAME_MAX];
int fileToLoad = FALSE; int fileToLoad = FALSE;
char parentdir[MAXPATHLEN]; char parentdir[MAXPATHLEN];
unsigned short macOSXDisplayWidth(void)
{
return(CGDisplayPixelsWide(kCGDirectMainDisplay));
}
unsigned short macOSXDisplayHeight(void)
{
return(CGDisplayPixelsHigh(kCGDirectMainDisplay));
}
/* A helper category for NSString */ /* A helper category for NSString */
@interface NSString (ReplaceSubString) @interface NSString (ReplaceSubString)
- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString; - (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;