55 |
55 |
56 #include "../../stdafx.h" |
56 #include "../../stdafx.h" |
57 #include "../../openttd.h" |
57 #include "../../openttd.h" |
58 #include "../../debug.h" |
58 #include "../../debug.h" |
59 #include "../../variables.h" |
59 #include "../../variables.h" |
|
60 #include "../../core/geometry_type.hpp" |
60 #include "cocoa_v.h" |
61 #include "cocoa_v.h" |
61 #include "../../blitter/factory.hpp" |
62 #include "../../blitter/factory.hpp" |
62 #include "../../fileio.h" |
63 #include "../../fileio.h" |
63 |
64 #include "../../gfx_func.h" |
64 #undef Point |
|
65 #undef Rect |
|
66 |
65 |
67 |
66 |
68 @interface OTTDMain : NSObject |
67 @interface OTTDMain : NSObject |
69 @end |
68 @end |
70 |
69 |
230 |
229 |
231 static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp) |
230 static CocoaSubdriver *QZ_CreateWindowSubdriver(int width, int height, int bpp) |
232 { |
231 { |
233 CocoaSubdriver *ret; |
232 CocoaSubdriver *ret; |
234 |
233 |
|
234 #ifdef ENABLE_COCOA_QUARTZ |
235 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 |
235 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 |
236 if (MacOSVersionIsAtLeast(10, 4, 0)) { |
236 /* The reason for the version mismatch is due to the fact that the 10.4 binary needs to work on 10.5 as well. */ |
|
237 if (MacOSVersionIsAtLeast(10, 5, 0)) { |
237 ret = QZ_CreateWindowQuartzSubdriver(width, height, bpp); |
238 ret = QZ_CreateWindowQuartzSubdriver(width, height, bpp); |
238 if (ret != NULL) return ret; |
239 if (ret != NULL) return ret; |
239 } |
240 } |
240 #endif |
241 #endif |
241 |
242 #endif |
|
243 |
|
244 #ifdef ENABLE_COCOA_QUICKDRAW |
242 ret = QZ_CreateWindowQuickdrawSubdriver(width, height, bpp); |
245 ret = QZ_CreateWindowQuickdrawSubdriver(width, height, bpp); |
243 if (ret != NULL) return ret; |
246 if (ret != NULL) return ret; |
|
247 #endif |
|
248 |
|
249 #ifdef ENABLE_COCOA_QUARTZ |
|
250 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 |
|
251 /* |
|
252 * If we get here we are running 10.4 or earlier and either openttd was compiled without the quickdraw driver |
|
253 * or it failed to load for some reason. Fall back to Quartz if possible even though that driver is slower. |
|
254 */ |
|
255 if (MacOSVersionIsAtLeast(10, 4, 0)) { |
|
256 ret = QZ_CreateWindowQuartzSubdriver(width, height, bpp); |
|
257 if (ret != NULL) return ret; |
|
258 } |
|
259 #endif |
|
260 #endif |
244 |
261 |
245 return NULL; |
262 return NULL; |
246 } |
263 } |
247 |
264 |
248 |
265 |
367 } |
384 } |
368 |
385 |
369 QZ_GameSizeChanged(); |
386 QZ_GameSizeChanged(); |
370 |
387 |
371 QZ_UpdateVideoModes(); |
388 QZ_UpdateVideoModes(); |
|
389 return _cocoa_subdriver->IsFullscreen() == full_screen; |
372 } |
390 } |
373 |
391 |
374 |
392 |
375 /* This is needed since sometimes assert is called before the videodriver is initialized */ |
393 /* This is needed since sometimes assert is called before the videodriver is initialized */ |
376 void CocoaDialog(const char* title, const char* message, const char* buttonLabel) |
394 void CocoaDialog(const char* title, const char* message, const char* buttonLabel) |