Files
@ r26684:bd3e30073232
Branch filter:
Location: cpp/openttd-patchpack/source/src/video/cocoa/cocoa_v.h - annotation
r26684:bd3e30073232
4.0 KiB
text/x-c
Add: Additional vehicle flags to control variants.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r12768:980ae0491352 r9111:983de9c5a848 r9111:983de9c5a848 r7939:523d421f9d0c r7939:523d421f9d0c r7939:523d421f9d0c r7939:523d421f9d0c r24565:5dd2777a6959 r24565:5dd2777a6959 r7939:523d421f9d0c r24556:fb8120e96ffe r24556:fb8120e96ffe r24768:48450d9ea0c2 r24772:2d660991e437 r24772:2d660991e437 r24768:48450d9ea0c2 r21028:e5db3f83cafa r24565:5dd2777a6959 r26145:f785a693652c r26145:f785a693652c r24764:1ef60c5f1172 r7939:523d421f9d0c r24781:5fac82465296 r24764:1ef60c5f1172 r24772:2d660991e437 r24772:2d660991e437 r24764:1ef60c5f1172 r24764:1ef60c5f1172 r24768:48450d9ea0c2 r24768:48450d9ea0c2 r24764:1ef60c5f1172 r24764:1ef60c5f1172 r24764:1ef60c5f1172 r23497:a0ab44ebd2fa r23497:a0ab44ebd2fa r7939:523d421f9d0c r24767:dedfc39121ac r24767:dedfc39121ac r24767:dedfc39121ac r23497:a0ab44ebd2fa r23497:a0ab44ebd2fa r12935:993da883d0df r26145:f785a693652c r26145:f785a693652c r26145:f785a693652c r23497:a0ab44ebd2fa r20648:393668109c79 r25019:7bd7e70574c6 r25019:7bd7e70574c6 r24565:5dd2777a6959 r24565:5dd2777a6959 r24941:4e760118066a r24565:5dd2777a6959 r24920:a20fba25923b r24764:1ef60c5f1172 r24665:20a8caea4459 r24919:657f22b3726f r24920:a20fba25923b r24920:a20fba25923b r24665:20a8caea4459 r24798:b9ee83bbe580 r24849:01243a72f255 r24920:a20fba25923b r24920:a20fba25923b r24939:f00f6879a003 r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24665:20a8caea4459 r24920:a20fba25923b r24920:a20fba25923b r24920:a20fba25923b r24920:a20fba25923b r24920:a20fba25923b r24565:5dd2777a6959 r24767:dedfc39121ac r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24762:5a4d1e409614 r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24768:48450d9ea0c2 r24919:657f22b3726f r24762:5a4d1e409614 r24919:657f22b3726f r24762:5a4d1e409614 r18063:14deaddcaab9 r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24920:a20fba25923b r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24919:657f22b3726f r24920:a20fba25923b r24920:a20fba25923b r7939:523d421f9d0c r7939:523d421f9d0c r24919:657f22b3726f r24764:1ef60c5f1172 r25003:fdd8312ceea6 r24919:657f22b3726f r24764:1ef60c5f1172 r7939:523d421f9d0c r7939:523d421f9d0c | /*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file cocoa_v.h The Cocoa video driver. */
#ifndef VIDEO_COCOA_H
#define VIDEO_COCOA_H
#include "../video_driver.hpp"
#include "../../core/geometry_type.hpp"
extern bool _cocoa_video_started;
@class OTTD_CocoaWindowDelegate;
@class OTTD_CocoaWindow;
@class OTTD_CocoaView;
class VideoDriver_Cocoa : public VideoDriver {
private:
Dimension orig_res; ///< Saved window size for non-fullscreen mode.
bool refresh_sys_sprites; ///< System sprites need refreshing.
public:
bool setup; ///< Window is currently being created.
OTTD_CocoaWindow *window; ///< Pointer to window object
OTTD_CocoaView *cocoaview; ///< Pointer to view object
CGColorSpaceRef color_space; ///< Window color space
OTTD_CocoaWindowDelegate *delegate; //!< Window delegate object
public:
VideoDriver_Cocoa();
void Stop() override;
void MainLoop() override;
void MakeDirty(int left, int top, int width, int height) override;
bool AfterBlitterChange() override;
bool ChangeResolution(int w, int h) override;
bool ToggleFullscreen(bool fullscreen) override;
void ClearSystemSprites() override;
void PopulateSystemSprites() override;
void EditBoxLostFocus() override;
std::vector<int> GetListOfMonitorRefreshRates() override;
/* --- The following methods should be private, but can't be due to Obj-C limitations. --- */
void MainLoopReal();
virtual void AllocateBackingStore(bool force = false) = 0;
protected:
Rect dirty_rect; ///< Region of the screen that needs redrawing.
bool buffer_locked; ///< Video buffer was locked by the main thread.
Dimension GetScreenSize() const override;
float GetDPIScale() override;
void InputLoop() override;
bool LockVideoBuffer() override;
void UnlockVideoBuffer() override;
bool PollEvent() override;
void GameSizeChanged();
const char *Initialize();
void UpdateVideoModes();
bool MakeWindow(int width, int height);
virtual NSView* AllocateDrawView() = 0;
/** Get a pointer to the video buffer. */
virtual void *GetVideoPointer() = 0;
/** Hand video buffer back to the drawing backend. */
virtual void ReleaseVideoPointer() {}
private:
bool IsFullscreen();
};
class VideoDriver_CocoaQuartz : public VideoDriver_Cocoa {
private:
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
int window_width; ///< Current window width in pixel
int window_height; ///< Current window height in pixel
int window_pitch;
uint32 palette[256]; ///< Colour Palette
void BlitIndexedToView32(int left, int top, int right, int bottom);
void UpdatePalette(uint first_color, uint num_colors);
public:
CGContextRef cgcontext; ///< Context reference for Quartz subdriver
VideoDriver_CocoaQuartz();
const char *Start(const StringList ¶m) override;
void Stop() override;
/** Return driver name */
const char *GetName() const override { return "cocoa"; }
void AllocateBackingStore(bool force = false) override;
protected:
void Paint() override;
void CheckPaletteAnim() override;
NSView* AllocateDrawView() override;
void *GetVideoPointer() override { return this->buffer_depth == 8 ? this->pixel_buffer : this->window_buffer; }
};
class FVideoDriver_CocoaQuartz : public DriverFactoryBase {
public:
FVideoDriver_CocoaQuartz() : DriverFactoryBase(Driver::DT_VIDEO, 8, "cocoa", "Cocoa Video Driver") {}
Driver *CreateInstance() const override { return new VideoDriver_CocoaQuartz(); }
};
#endif /* VIDEO_COCOA_H */
|