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