summaryrefslogtreecommitdiff
path: root/src/video/cocoa/cocoa_v.h
diff options
context:
space:
mode:
authoregladil <egladil@openttd.org>2007-11-22 21:48:17 +0000
committeregladil <egladil@openttd.org>2007-11-22 21:48:17 +0000
commit3ad488e98f12529ebbca3f43ba5eedae4f46d049 (patch)
treec16e83ac270622e3c3730669fd186602c869d1a2 /src/video/cocoa/cocoa_v.h
parent2653d94bcb5ee9238764e129eb504fa62c428916 (diff)
downloadopenttd-3ad488e98f12529ebbca3f43ba5eedae4f46d049.tar.xz
(svn r11492) -Codechange: [OSX] Split the cocoa video driver into several files. The reason for this is that the fullscreen and windowed mode api are separate from each other in OS X and thus the driver actual is two drivers in one. This split is to make the code more readable and to prepare for replacing the Quickdraw windowed mode code which uses apis deprecated as of OS X 10.5 (and maybe earlier).
Diffstat (limited to 'src/video/cocoa/cocoa_v.h')
-rw-r--r--src/video/cocoa/cocoa_v.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/video/cocoa/cocoa_v.h b/src/video/cocoa/cocoa_v.h
new file mode 100644
index 000000000..fb53fb2ee
--- /dev/null
+++ b/src/video/cocoa/cocoa_v.h
@@ -0,0 +1,71 @@
+/* $Id$ */
+
+#ifndef VIDEO_COCOA_H
+#define VIDEO_COCOA_H
+
+#include "../video_driver.hpp"
+
+class VideoDriver_Cocoa: public VideoDriver {
+public:
+ /* virtual */ const char *Start(const char * const *param);
+
+ /* virtual */ void Stop();
+
+ /* virtual */ void MakeDirty(int left, int top, int width, int height);
+
+ /* virtual */ void MainLoop();
+
+ /* virtual */ bool ChangeResolution(int w, int h);
+
+ /* virtual */ void ToggleFullscreen(bool fullscreen);
+};
+
+class FVideoDriver_Cocoa: public VideoDriverFactory<FVideoDriver_Cocoa> {
+public:
+ static const int priority = 10;
+ /* virtual */ const char *GetName() { return "cocoa"; }
+ /* virtual */ const char *GetDescription() { return "Cocoa Video Driver"; }
+ /* virtual */ Driver *CreateInstance() { return new VideoDriver_Cocoa(); }
+};
+
+
+
+class CocoaSubdriver {
+public:
+ virtual ~CocoaSubdriver() {}
+
+ virtual void Draw() = 0;
+ virtual void MakeDirty(int left, int top, int width, int height) = 0;
+ virtual void UpdatePalette(uint first_color, uint num_colors) = 0;
+
+ virtual uint ListModes(OTTDPoint* modes, uint max_modes) = 0;
+
+ virtual bool ChangeResolution(int w, int h) = 0;
+
+ virtual bool IsFullscreen() = 0;
+ virtual int GetWidth() = 0;
+ virtual int GetHeight() = 0;
+ virtual void *GetPixelBuffer() = 0;
+
+ /* Convert local coordinate to window server (CoreGraphics) coordinate */
+ virtual CGPoint PrivateLocalToCG(NSPoint* p) = 0;
+
+ virtual NSPoint GetMouseLocation(NSEvent *event) = 0;
+ virtual bool MouseIsInsideView(NSPoint *pt) = 0;
+
+ virtual bool IsActive() = 0;
+};
+
+extern CocoaSubdriver* _cocoa_subdriver;
+
+CocoaSubdriver *QZ_CreateFullscreenSubdriver(int width, int height, int bpp);
+CocoaSubdriver *QZ_CreateWindowQuickdrawSubdriver(int width, int height, int bpp);
+
+void QZ_GameSizeChanged();
+
+void QZ_GameLoop();
+
+void QZ_ShowMouse();
+void QZ_HideMouse();
+
+#endif /* VIDEO_COCOA_H */