Public Member Functions | Data Fields

# CocoaSubdriver Class Reference

Generic display driver for cocoa On grounds to not duplicate some code, it contains a few variables which are not used by all device drivers. More...

`#include <cocoa_v.h>`

## Public Member Functions
virtual | ~CocoaSubdriver ()
| Initialize driver.
virtual void | Draw (bool force_update=false)=0
| Draw window.
virtual void | MakeDirty (int left, int top, int width, int height)=0
| Mark dirty a screen region.
virtual void | UpdatePalette (uint first_color, uint num_colors)=0
| Update the palette.
virtual uint | ListModes (OTTD_Point *modes, uint max_modes)=0
virtual bool | ChangeResolution (int w, int h, int bpp)=0
| Change window resolution.
virtual bool | IsFullscreen ()=0
| Are we in fullscreen mode.
virtual bool | ToggleFullscreen ()
| Toggle between fullscreen and windowed mode.
virtual int | GetWidth ()=0
| Return the width of the current view.
virtual int | GetHeight ()=0
| Return the height of the current view.
virtual void * | GetPixelBuffer ()=0
| Return the current pixel buffer.
virtual CGPoint | PrivateLocalToCG (NSPoint *p)=0
| Convert local coordinate to window server (CoreGraphics) coordinate.
virtual NSPoint | GetMouseLocation (NSEvent *event)=0
| Return the mouse location.
virtual bool | MouseIsInsideView (NSPoint *pt)=0
| Return whether the mouse is within our view.
virtual bool | IsActive ()=0
| Return whether the window is active (visible).
virtual void | SetPortAlphaOpaque ()
| Makes the *game region* of the window 100% opaque.
virtual bool | WindowResized ()
| Whether the window was successfully resized.
## Data Fields
int | device_width
| Width of device in pixel.
int | device_height
| Height of device in pixel.
int | device_depth
| Colour depth of device in bit.
int | window_width
| Current window width in pixel.
int | window_height
| Current window height in pixel.
int | window_pitch
int | buffer_depth
| Colour depth of used frame buffer.
void * | pixel_buffer
| used for direct pixel access
void * | window_buffer
| Colour translation from palette to screen.
id | window
| Pointer to window object.
Rect | dirty_rects [MAX_DIRTY_RECTS]
| dirty rectangles
int | num_dirty_rects
| Number of dirty rectangles.
uint32 | palette [256]
| Colour Palette.
bool | active
| Whether the window is visible.
bool | setup
id | cocoaview
| Pointer to view object.
CGContextRef | cgcontext
| Context reference for Quartz subdriver.

## Detailed Description

Generic display driver for cocoa On grounds to not duplicate some code, it contains a few variables which are not used by all device drivers.

Definition at line 73 of file cocoa_v.h.

## Member Function Documentation

virtual bool CocoaSubdriver::ChangeResolution | ( | int | w,
|  | int | h,
|  | int | bpp |
| ) |  |  | `[pure virtual]`

Change window resolution.

Parameters:

  | w | New window width
  | h | New window height

Returns:
  Whether change was successful

virtual void CocoaSubdriver::Draw | ( | bool | force_update = `false` | ) | `[pure virtual]`

Draw window.

Parameters:

  | force_update | Whether to redraw unconditionally

virtual int CocoaSubdriver::GetHeight | ( |  | ) | `[pure virtual]`

Return the height of the current view.

Returns:
  height of the current view

virtual NSPoint CocoaSubdriver::GetMouseLocation | ( | NSEvent * | event | ) | `[pure virtual]`

Return the mouse location.

Parameters:

  | event | UI event

Returns:
  mouse location as NSPoint

virtual void* CocoaSubdriver::GetPixelBuffer | ( |  | ) | `[pure virtual]`

Return the current pixel buffer.

Returns:
  pixelbuffer

virtual int CocoaSubdriver::GetWidth | ( |  | ) | `[pure virtual]`

Return the width of the current view.

Returns:
  width of the current view

virtual bool CocoaSubdriver::IsActive | ( |  | ) | `[pure virtual]`

Return whether the window is active (visible).

Returns:
  whether the window is visible or not

virtual bool CocoaSubdriver::IsFullscreen | ( |  | ) | `[pure virtual]`

Are we in fullscreen mode.

Returns:
  whether fullscreen mode is currently used

virtual void CocoaSubdriver::MakeDirty | ( | int | left,
|  | int | top,
|  | int | width,
|  | int | height |
| ) |  |  | `[pure virtual]`

Mark dirty a screen region.

Parameters:

  | left | x-coordinate of left border
  | top | y-coordinate of top border
  | width | width or dirty rectangle
  | height | height of dirty rectangle

virtual bool CocoaSubdriver::MouseIsInsideView | ( | NSPoint * | pt | ) | `[pure virtual]`

Return whether the mouse is within our view.

Parameters:

  | pt | Mouse coordinates

Returns:
  Whether mouse coordinates are within view

virtual CGPoint CocoaSubdriver::PrivateLocalToCG | ( | NSPoint * | p | ) | `[pure virtual]`

Convert local coordinate to window server (CoreGraphics) coordinate.

Parameters:

  | p | local coordinates

Returns:
  window driver coordinates

virtual void CocoaSubdriver::SetPortAlphaOpaque | ( |  | ) | `[inline, virtual]`

Makes the *game region* of the window 100% opaque.

Definition at line 180 of file cocoa_v.h.

virtual bool CocoaSubdriver::ToggleFullscreen | ( |  | ) | `[inline, virtual]`

Toggle between fullscreen and windowed mode.

Returns:
  whether switch was successfull

Definition at line 139 of file cocoa_v.h.

virtual bool CocoaSubdriver::WindowResized | ( |  | ) | `[inline, virtual]`

Whether the window was successfully resized.

Returns:
  whether the window was succesfully resized

Definition at line 185 of file cocoa_v.h.

The documentation for this class was generated from the following file:

- src/video/cocoa/cocoa_v.h