cocoa_v.h
00001
00002
00003 #ifndef VIDEO_COCOA_H
00004 #define VIDEO_COCOA_H
00005
00006 #include <AvailabilityMacros.h>
00007
00008 #include "../video_driver.hpp"
00009
00010 class VideoDriver_Cocoa: public VideoDriver {
00011 public:
00012 const char *Start(const char * const *param);
00013
00014 void Stop();
00015
00016 void MakeDirty(int left, int top, int width, int height);
00017
00018 void MainLoop();
00019
00020 bool ChangeResolution(int w, int h);
00021
00022 bool ToggleFullscreen(bool fullscreen);
00023 };
00024
00025 class FVideoDriver_Cocoa: public VideoDriverFactory<FVideoDriver_Cocoa> {
00026 public:
00027 static const int priority = 10;
00028 const char *GetName() { return "cocoa"; }
00029 const char *GetDescription() { return "Cocoa Video Driver"; }
00030 Driver *CreateInstance() { return new VideoDriver_Cocoa(); }
00031 };
00032
00033
00034
00035 class CocoaSubdriver {
00036 public:
00037 virtual ~CocoaSubdriver() {}
00038
00039 virtual void Draw() = 0;
00040 virtual void MakeDirty(int left, int top, int width, int height) = 0;
00041 virtual void UpdatePalette(uint first_color, uint num_colors) = 0;
00042
00043 virtual uint ListModes(OTTD_Point* modes, uint max_modes) = 0;
00044
00045 virtual bool ChangeResolution(int w, int h) = 0;
00046
00047 virtual bool IsFullscreen() = 0;
00048 virtual int GetWidth() = 0;
00049 virtual int GetHeight() = 0;
00050 virtual void *GetPixelBuffer() = 0;
00051
00052
00053 virtual CGPoint PrivateLocalToCG(NSPoint* p) = 0;
00054
00055 virtual NSPoint GetMouseLocation(NSEvent *event) = 0;
00056 virtual bool MouseIsInsideView(NSPoint *pt) = 0;
00057
00058 virtual bool IsActive() = 0;
00059 };
00060
00061 extern CocoaSubdriver* _cocoa_subdriver;
00062
00063 CocoaSubdriver *QZ_CreateFullscreenSubdriver(int width, int height, int bpp);
00064
00065 #ifdef ENABLE_COCOA_QUICKDRAW
00066 CocoaSubdriver *QZ_CreateWindowQuickdrawSubdriver(int width, int height, int bpp);
00067 #endif
00068
00069 #ifdef ENABLE_COCOA_QUARTZ
00070 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
00071 CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(int width, int height, int bpp);
00072 #endif
00073 #endif
00074
00075 void QZ_GameSizeChanged();
00076
00077 void QZ_GameLoop();
00078
00079 void QZ_ShowMouse();
00080 void QZ_HideMouse();
00081
00082 uint QZ_ListModes(OTTD_Point* modes, uint max_modes, CGDirectDisplayID display_id, int display_depth);
00083
00084 #endif