Changeset - r7176:97b7675a2ff1
[Not reviewed]
master
0 1 0
peter1138 - 17 years ago 2007-07-05 18:21:53
peter1138@openttd.org
(svn r10450) -Fix (r10444): Fix search & replace errors
1 file changed with 7 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/video/cocoa_v.mm
Show inline comments
 
@@ -130,25 +130,25 @@ struct OTTD_QuartzGammaTable {
 
static void QZ_Draw();
 
static void QZ_UnsetVideoMode();
 
static void QZ_UpdatePalette(uint start, uint count);
 
static void QZ_WarpCursor(int x, int y);
 
static void QZ_ShowMouse();
 
static void QZ_HideMouse();
 

	
 

	
 
static NSAutoreleasePool *_ottd_autorelease_pool;
 
static OTTDMain *_ottd_main;
 

	
 

	
 
static struct VideoDriver_Cocoa::Data {
 
static struct CocoaVideoData {
 
	bool isset;
 
	bool issetting;
 

	
 
	CGDirectDisplayID  display_id;         /* 0 == main display (only support single display) */
 
	CFDictionaryRef    mode;               /* current mode of the display */
 
	CFDictionaryRef    save_mode;          /* original mode of the display */
 
	CFArrayRef         mode_list;          /* list of available fullscreen modes */
 
	CGDirectPaletteRef palette;            /* palette of an 8-bit display */
 

	
 
	uint32 device_width;
 
	uint32 device_height;
 
	uint32 device_bpp;
 
@@ -1311,27 +1311,27 @@ static uint32 QZ_FadeGammaIn(const OTTD_
 
					redTable, greenTable, blueTable
 
				) != CGDisplayNoErr) {
 
			CGDisplayRestoreColorSyncSettings();
 
			return 1;
 
		}
 

	
 
		CSleep(10);
 
	}
 

	
 
	return 0;
 
}
 

	
 
static const char* QZ_SetVideoToggleFullscreen(int width, int height)
 
static const char* QZ_SetVideoFullScreen(int width, int height)
 
{
 
	const char* errstr = "QZ_SetVideoToggleFullscreen error";
 
	const char* errstr = "QZ_SetVideoFullScreen error";
 
	int exact_match;
 
	CFNumberRef number;
 
	int bpp;
 
	int gamma_error;
 
	OTTD_QuartzGammaTable gamma_table;
 
	NSRect screen_rect;
 
	CGError error;
 
	NSPoint pt;
 

	
 
	/* Destroy any previous mode */
 
	if (_cocoa_video_data.isset) QZ_UnsetVideoMode();
 

	
 
@@ -1699,25 +1699,25 @@ static void QZ_UnsetVideoMode()
 

	
 
	QZ_ShowMouse();
 
}
 

	
 

	
 
static const char* QZ_SetVideoMode(uint width, uint height, bool fullscreen)
 
{
 
	const char *ret;
 

	
 
	_cocoa_video_data.issetting = true;
 
	if (fullscreen) {
 
		/* Setup full screen video */
 
		ret = QZ_SetVideoToggleFullscreen(width, height);
 
		ret = QZ_SetVideoFullScreen(width, height);
 
	} else {
 
		/* Setup windowed video */
 
		ret = QZ_SetVideoWindowed(width, height);
 
	}
 
	_cocoa_video_data.issetting = false;
 
	if (ret != NULL) return ret;
 

	
 
	/* Signal successful completion (used internally) */
 
	_cocoa_video_data.isset = true;
 

	
 
	/* Tell the game that the resolution has changed */
 
	_screen.width = _cocoa_video_data.width;
 
@@ -1992,25 +1992,25 @@ const char *VideoDriver_Cocoa::Start(con
 
	_cocoa_video_started = true;
 

	
 
	memset(&_cocoa_video_data, 0, sizeof(_cocoa_video_data));
 

	
 
	setupApplication();
 

	
 
	/* Don't create a window or enter fullscreen if we're just going to show a dialog. */
 
	if (_cocoa_video_dialog) return NULL;
 

	
 
	QZ_VideoInit();
 

	
 
	ret = QZ_SetVideoMode(_cur_resolution[0], _cur_resolution[1], _fullscreen);
 
	if (ret != NULL) VideoDriver_Cocoa::Stop();
 
	if (ret != NULL) _video_driver->Stop();
 

	
 
	return ret;
 
}
 

	
 
void VideoDriver_Cocoa::MakeDirty(int left, int top, int width, int height)
 
{
 
	if (_cocoa_video_data.num_dirty_rects < MAX_DIRTY_RECTS) {
 
		_cocoa_video_data.dirty_rects[_cocoa_video_data.num_dirty_rects].left = left;
 
		_cocoa_video_data.dirty_rects[_cocoa_video_data.num_dirty_rects].top = top;
 
		_cocoa_video_data.dirty_rects[_cocoa_video_data.num_dirty_rects].right = left + width;
 
		_cocoa_video_data.dirty_rects[_cocoa_video_data.num_dirty_rects].bottom = top + height;
 
	}
 
@@ -2043,32 +2043,32 @@ void VideoDriver_Cocoa::ToggleFullscreen
 
	_fullscreen = _cocoa_video_data.fullscreen;
 
}
 

	
 

	
 
/* This is needed since sometimes assert is called before the videodriver is initialized */
 
void CocoaDialog(const char* title, const char* message, const char* buttonLabel)
 
{
 
	bool wasstarted;
 

	
 
	_cocoa_video_dialog = true;
 

	
 
	wasstarted = _cocoa_video_started;
 
	if (!_cocoa_video_started && VideoDriver_Cocoa::Start(NULL) != NULL) {
 
	if (!_cocoa_video_started && _video_driver->Start(NULL) != NULL) {
 
		fprintf(stderr, "%s: %s\n", title, message);
 
		return;
 
	}
 

	
 
	NSRunAlertPanel([NSString stringWithCString: title], [NSString stringWithCString: message], [NSString stringWithCString: buttonLabel], nil, nil);
 

	
 
	if (!wasstarted) VideoDriver_Cocoa::Stop();
 
	if (!wasstarted) _video_driver->Stop();
 

	
 
	_cocoa_video_dialog = false;
 
}
 

	
 
/* This is needed since OS X application bundles do not have a
 
 * current directory and the data files are 'somewhere' in the bundle */
 
void cocoaSetApplicationBundleDir()
 
{
 
	char tmp[MAXPATHLEN];
 
	CFURLRef url = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
 
	if (CFURLGetFileSystemRepresentation(url, true, (unsigned char*)tmp, MAXPATHLEN)) {
 
		AppendPathSeparator(tmp, lengthof(tmp));
0 comments (0 inline, 0 general)