OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
13 #include "../video_driver.hpp"
14 #include "../../core/geometry_type.hpp"
17 extern bool _cocoa_video_started;
42 void MakeDirty(
int left,
int top,
int width,
int height)
override;
54 virtual void AllocateBackingStore(
bool force =
false) = 0;
67 void GameSizeChanged();
69 const char *Initialize();
71 void UpdateVideoModes();
73 bool MakeWindow(
int width,
int height);
75 virtual NSView* AllocateDrawView() = 0;
98 void BlitIndexedToView32(
int left,
int top,
int right,
int bottom);
99 void UpdatePalette(uint first_color, uint num_colors);
107 void Stop()
override;
110 const char *
GetName()
const override {
return "cocoa"; }
112 void AllocateBackingStore(
bool force =
false)
override;
115 void Paint()
override;
118 NSView* AllocateDrawView()
override;
virtual void * GetVideoPointer()=0
Get a pointer to the video buffer.
int buffer_depth
Colour depth of used frame buffer.
void * GetVideoPointer() override
Get a pointer to the video buffer.
int window_width
Current window width in pixel.
bool AfterBlitterChange() override
Callback invoked after the blitter was changed.
The base of all video drivers.
Dimensions (a width and height) of a rectangle in 2D.
void InputLoop() override
Handle input logic, is CTRL pressed, should we fast-forward, etc.
Driver * CreateInstance() const override
Create an instance of this driver-class.
bool ChangeResolution(int w, int h) override
Change the resolution of the window.
CGContextRef cgcontext
Context reference for Quartz subdriver.
DriverFactoryBase(Driver::Type type, int priority, const char *name, const char *description)
Construct a new DriverFactory.
Delegate for our NSWindow to send ask for quit on close.
int window_height
Current window height in pixel.
uint32 palette[256]
Colour Palette.
float GetDPIScale() override
Get DPI scaling factor of the screen OTTD is displayed on.
OTTD_CocoaView * cocoaview
Pointer to view object.
virtual void ReleaseVideoPointer()
Hand video buffer back to the drawing backend.
void * pixel_buffer
used for direct pixel access
bool buffer_locked
Video buffer was locked by the main thread.
const char * GetName() const override
Return driver name.
Dimension GetScreenSize() const override
Get the resolution of the main screen.
void Paint() override
Paint the window.
Rect dirty_rect
Region of the screen that needs redrawing.
bool PollEvent() override
Process a single system event.
void Stop() override
Stop this driver.
std::vector< std::string > StringList
Type for a list of strings.
OTTD_CocoaWindow * window
Pointer to window object.
void Stop() override
Stop this driver.
const char * Start(const StringList ¶m) override
Start this driver.
void * window_buffer
Colour translation from palette to screen.
bool setup
Window is currently being created.
void UnlockVideoBuffer() override
Unlock a previously locked video buffer.
Subclass of NSView to support mouse awareness and text input.
bool ToggleFullscreen(bool fullscreen) override
Change the full screen setting.
@ DT_VIDEO
A video driver.
OTTD_CocoaWindowDelegate * delegate
Window delegate object.
Subclass of NSWindow to cater our special needs.
void MainLoop() override
Perform the actual drawing.
void CheckPaletteAnim() override
Process any pending palette animation.
Dimension orig_res
Saved window size for non-fullscreen mode.
bool LockVideoBuffer() override
Make sure the video buffer is ready for drawing.
A driver for communicating with the user.
Specification of a rectangle with absolute coordinates of all edges.
CGColorSpaceRef color_space
Window color space.
Base for all driver factories.
void EditBoxLostFocus() override
An edit box lost the input focus.
void MakeDirty(int left, int top, int width, int height) override
Mark a particular area dirty.