cocoa_v.h

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

Generated on Sun Nov 15 15:40:16 2009 for OpenTTD by  doxygen 1.5.6