cocoa_v.h

00001 /* $Id: cocoa_v.h 11734 2008-01-01 14:20:48Z belugas $ */
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   /* virtual */ const char *Start(const char * const *param);
00013 
00014   /* virtual */ void Stop();
00015 
00016   /* virtual */ void MakeDirty(int left, int top, int width, int height);
00017 
00018   /* virtual */ void MainLoop();
00019 
00020   /* virtual */ bool ChangeResolution(int w, int h);
00021 
00022   /* virtual */ bool ToggleFullscreen(bool fullscreen);
00023 };
00024 
00025 class FVideoDriver_Cocoa: public VideoDriverFactory<FVideoDriver_Cocoa> {
00026 public:
00027   static const int priority = 10;
00028   /* virtual */ const char *GetName() { return "cocoa"; }
00029   /* virtual */ const char *GetDescription() { return "Cocoa Video Driver"; }
00030   /* virtual */ 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   /* Convert local coordinate to window server (CoreGraphics) coordinate */
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 /* VIDEO_COCOA_H */

Generated on Mon Sep 22 20:34:20 2008 for openttd by  doxygen 1.5.6