15 #include "../video_driver.hpp" 19 const char *
Start(
const char *
const *param);
30 void MakeDirty(
int left,
int top,
int width,
int height);
61 const char *
GetName()
const {
return "cocoa"; }
91 # define MAX_DIRTY_RECTS 100 92 Rect dirty_rects[MAX_DIRTY_RECTS];
112 virtual void Draw(
bool force_update =
false) = 0;
120 virtual void MakeDirty(
int left,
int top,
int width,
int height) = 0;
123 virtual void UpdatePalette(uint first_color, uint num_colors) = 0;
125 virtual uint ListModes(OTTD_Point *modes, uint max_modes) = 0;
137 virtual bool IsFullscreen() = 0;
147 virtual int GetWidth() = 0;
152 virtual int GetHeight() = 0;
157 virtual void *GetPixelBuffer() = 0;
163 virtual CGPoint PrivateLocalToCG(NSPoint *p) = 0;
169 virtual NSPoint GetMouseLocation(NSEvent *event) = 0;
175 virtual bool MouseIsInsideView(NSPoint *pt) = 0;
180 virtual bool IsActive() = 0;
193 CocoaSubdriver *QZ_CreateFullscreenSubdriver(
int width,
int height,
int bpp);
195 #ifdef ENABLE_COCOA_QUICKDRAW 196 CocoaSubdriver *QZ_CreateWindowQuickdrawSubdriver(
int width,
int height,
int bpp);
199 #ifdef ENABLE_COCOA_QUARTZ 200 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 201 CocoaSubdriver *QZ_CreateWindowQuartzSubdriver(
int width,
int height,
int bpp);
205 void QZ_GameSizeChanged();
209 uint QZ_ListModes(OTTD_Point *modes, uint max_modes, CGDirectDisplayID display_id,
int display_depth);
213 + (NSCursor *) clearCocoaCursor;
223 - (void)miniaturize:(
id)sender;
225 - (void)setFrame:(NSRect)frameRect display:(BOOL)flag;
226 - (void)appDidHide:(NSNotification*)note;
227 - (void)appWillUnhide:(NSNotification*)note;
228 - (void)appDidUnhide:(NSNotification*)note;
229 - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag;
234 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 235 # if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 236 <NSTextInputClient, NSTextInput>
245 NSTrackingRectTag trackingtag;
248 - (void)drawRect:(NSRect)rect;
250 - (BOOL)acceptsFirstResponder;
251 - (BOOL)becomeFirstResponder;
252 - (void)setTrackingRect;
253 - (void)clearTrackingRect;
254 - (void)resetCursorRects;
255 - (void)viewWillMoveToWindow:(NSWindow *)win;
256 - (void)viewDidMoveToWindow;
257 - (void)mouseEntered:(NSEvent *)theEvent;
258 - (void)mouseExited:(NSEvent *)theEvent;
268 - (BOOL)windowShouldClose:(
id)sender;
269 - (void)windowDidEnterFullScreen:(NSNotification *)aNotification;
bool ChangeResolution(int w, int h)
Change window resolution.
void MakeDirty(int left, int top, int width, int height)
Mark dirty a screen region.
int window_height
Current window height in pixel.
Category of NSCursor to allow cursor showing/hiding.
Delegate for our NSWindow to send ask for quit on close.
id cocoaview
Pointer to view object.
virtual bool WindowResized()
Whether the window was successfully resized.
void * window_buffer
Colour translation from palette to screen.
virtual bool ToggleFullscreen()
Toggle between fullscreen and windowed mode.
Base for all driver factories.
void MainLoop()
Programme main loop.
void * pixel_buffer
used for direct pixel access
int device_width
Width of device in pixel.
int device_depth
Colour depth of device in bit.
Generic display driver for cocoa On grounds to not duplicate some code, it contains a few variables w...
A driver for communicating with the user.
bool ToggleFullscreen(bool fullscreen)
Set a new window mode.
bool active
Whether the window is visible.
const char * Start(const char *const *param)
Start this driver.
virtual void SetPortAlphaOpaque()
Makes the game region of the window 100% opaque.
const char * GetName() const
Return driver name.
Driver * CreateInstance() const
Create an instance of this driver-class.
Subclass of NSWindow to cater our special needs.
void Stop()
Stop the video driver.
int buffer_depth
Colour depth of used frame buffer.
int num_dirty_rects
Number of dirty rectangles.
The base of all video drivers.
CGContextRef cgcontext
Context reference for Quartz subdriver.
int device_height
Height of device in pixel.
Specification of a rectangle with absolute coordinates of all edges.
virtual ~CocoaSubdriver()
Initialize driver.
id window
Pointer to window object.
bool AfterBlitterChange()
Callback invoked after the blitter was changed.
void EditBoxLostFocus()
An edit box lost the input focus.
int window_width
Current window width in pixel.
Subclass of NSView to fix Quartz rendering and mouse awareness.