|
OpenTTD Source
1.11.0-beta1
|
Go to the documentation of this file.
13 #include "../video_driver.hpp"
14 #include "../../core/geometry_type.hpp"
17 extern bool _cocoa_video_started;
66 const char *
GetName()
const override {
return "cocoa"; }
77 friend class WindowQuartzSubdriver;
107 CGColorSpaceRef color_space;
110 # define MAX_DIRTY_RECTS 100
131 virtual void Draw(
bool force_update =
false) = 0;
142 virtual void UpdatePalette(uint first_color, uint num_colors) = 0;
144 virtual uint ListModes(OTTD_Point *modes, uint max_modes) = 0;
211 uint QZ_ListModes(OTTD_Point *modes, uint max_modes, CGDirectDisplayID display_id,
int display_depth);
void * window_buffer
Colour translation from palette to screen.
bool active
Whether the window is visible.
bool fullscreen
Whether to use (true) fullscreen mode.
int device_depth
Colour depth of device in bit.
virtual void MakeDirty(int left, int top, int width, int height)=0
Mark dirty a screen region.
const char * GetName() const override
Return driver name.
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.
int num_dirty_rects
Number of dirty rectangles.
virtual void UpdatePalette(uint first_color, uint num_colors)=0
Update the palette.
bool ChangeResolution(int w, int h) override
Change window resolution.
Generic display driver for cocoa On grounds to not duplicate some code, it contains a few variables w...
DriverFactoryBase(Driver::Type type, int priority, const char *name, const char *description)
Construct a new DriverFactory.
virtual bool MouseIsInsideView(NSPoint *pt)=0
Return whether the mouse is within our view.
virtual int GetWidth()=0
Return the width of the current view.
void GameLoop()
Main game loop.
int height
Height in pixels of our display surface.
int window_width
Current window width in pixel.
virtual CGPoint PrivateLocalToCG(NSPoint *p)=0
Convert local coordinate to window server (CoreGraphics) coordinate.
virtual bool IsFullscreen()=0
Are we in fullscreen mode.
virtual void Draw(bool force_update=false)=0
Draw window.
virtual bool IsActive()=0
Return whether the window is active (visible)
virtual int GetHeight()=0
Return the height of the current view.
virtual NSPoint GetMouseLocation(NSEvent *event)=0
Return the mouse location.
void Stop() override
Stop the video driver.
virtual ~CocoaSubdriver()
Initialize driver.
std::vector< std::string > StringList
Type for a list of strings.
virtual void * GetPixelBuffer()=0
Return the current pixel buffer.
int device_height
Height of device in pixel.
virtual bool ChangeResolution(int w, int h, int bpp)=0
Change window resolution.
int device_width
Width of device in pixel.
id cocoaview
Pointer to view object.
bool ToggleFullscreen(bool fullscreen) override
Set a new window mode.
const char * Start(const StringList ¶m) override
Start this driver.
Rect dirty_rects[MAX_DIRTY_RECTS]
dirty rectangles
CGContextRef cgcontext
Context reference for Quartz subdriver.
@ DT_VIDEO
A video driver.
virtual bool WindowResized()
Whether the window was successfully resized.
void MainLoop() override
Programme main loop.
int width
Width in pixels of our display surface.
Dimension orig_res
Saved window size for non-fullscreen mode.
id window
Pointer to window object.
void * pixel_buffer
used for direct pixel access
void GameSizeChanged()
Size of the application screen changed.
uint32 palette[256]
Colour Palette.
int buffer_depth
Colour depth of used frame buffer.
Driver * CreateInstance() const override
Create an instance of this driver-class.
A driver for communicating with the user.
int window_height
Current window height in pixel.
Specification of a rectangle with absolute coordinates of all edges.
Base for all driver factories.
void EditBoxLostFocus() override
An edit box lost the input focus.
virtual bool ToggleFullscreen(bool fullscreen)
Toggle between fullscreen and windowed mode.
void MakeDirty(int left, int top, int width, int height) override
Mark dirty a screen region.