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