YSTest: YDevice.h 源文件

YSTest PreAlpha_b900_20201012 The YSLib Test Project

YDevice.h
浏览该文件的文档.
1 /*
2 © 2009-2015, 2019-2020 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YSL_INC_Core_YDevice_h_
29 #define YSL_INC_Core_YDevice_h_ 1
30
31 #include "YModules.h"
32 #include YFM_YSLib_Core_YObject // for function, ystdex::unsupported;
33 #include YFM_YSLib_Core_YGraphics
34
35 namespace YSLib
36 {
37
38 namespace Devices
39 {
40
45 class YF_API GraphicDevice : private noncopyable, protected Drawing::Graphics
46 {
47 public:
49 using Graphics = Drawing::Graphics;
50
55 GraphicDevice(const Drawing::Size& s, Drawing::BitmapPtr p = {}) ynothrow
56 : Graphics(p, s)
57 {}
62 virtual ~GraphicDevice();
63
65
66 using Graphics::operator!;
67
68 using Graphics::operator bool;
70
75 virtual DefGetter(const, unique_ptr<Drawing::IImage>, BackBuffer,
76 unique_ptr<Drawing::IImage>())
78
79 using Graphics::GetHeight;
80 using Graphics::GetWidth;
81 using Graphics::GetSize;
83
85 virtual DefSetter(, const Drawing::Size&, Size, sGraphics)
86 };
87
88
93 class YF_API KeyInputDevice
94 {
95 public:
97 using Tester = function<bool(const KeyInput&, KeyIndex)>;
98
99 private:
101 KeyIndex width;
102
103 public:
104 explicit
105 KeyInputDevice(KeyIndex w = KeyBitsetWidth)
106 : width(w)
107 {
108 YAssert(w != 0, "Invalid key input device found.");
109 }
111 DefDeCopyCtor(KeyInputDevice)
113 virtual ~KeyInputDevice();
114
115 DefGetter(const ynothrow, KeyIndex, Width, width)
116
117
118 virtual PDefH(KeyIndex, Map, KeyIndex code)
119 ImplRet(code < width ? code : 0)
120
122 static PDefH(bool, DefaultTest, const KeyInput& keys, KeyIndex code)
123 ImplRet(code < KeyBitsetWidth ? keys[code] : false)
124 };
125
126
132 class YF_API Screen : public GraphicDevice
133 {
134 public:
139 Screen(const Drawing::Size& s, Drawing::BitmapPtr p = {}) ynothrow
140 : GraphicDevice(s, p)
141 {}
142
149 YB_NONNULL(2) virtual void
150 Update(Drawing::ConstBitmapPtr) ynothrow;
151
153 PDefH(void, SetSize, const Drawing::Size&) override
154 ImplThrow(
155 ystdex::unsupported("The screen does not support alter the size."))
156 };
157
158 } // namespace Devices;
159
160 } // namespace YSLib;
161
162 #endif
163
YSLib::Devices::KeyInputDevice::DefDeCopyCtor
DefDeCopyCtor(KeyInputDevice) virtual ~KeyInputDevice()
虚析构：类定义外默认实现。
size
size_t size
Definition: memory_resource.cpp:295
YSLib::Devices::KeyInputDevice::width
KeyIndex width
宽度：设备支持的按键编码上界（不含）。
Definition: YDevice.h:101
YSLib::Drawing::Size
屏幕区域大小。
Definition: YGDIBase.h:536
YSLib::Drawing::Graphics
GGraphics< BitmapPtr > Graphics
Definition: YGraphics.h:163
YSLib::Devices::KeyInputDevice::DefGetter
DefGetter(const ynothrow, KeyIndex, Width, width) virtual PDefH(KeyIndex
按键映射。
YSLib::Devices::GraphicDevice::~GraphicDevice
virtual ~GraphicDevice()
虚析构：类定义外默认实现。
YF_API
#define YF_API
Definition: Platform.h:56
YSLib::Devices::KeyInputDevice::KeyInputDevice
KeyInputDevice(KeyIndex w=KeyBitsetWidth)
Definition: YDevice.h:105
YSLib::Devices::Screen::Screen
Screen(const Drawing::Size &s, Drawing::BitmapPtr p={}) ynothrow
构造：指定大小和缓冲区指针。
Definition: YDevice.h:139
YSLib::Devices::KeyInputDevice
按键输入设备。
Definition: YDevice.h:94
YSLib::YAssert
YAssert(!(v< Deref(a)), "Value less than lower bound found.")
YSLib::Drawing::GGraphics
二维图形接口上下文模板。
Definition: YGraphics.h:63
YSLib::Drawing::GetSize
dst GetSize()
YSLib::Devices::GraphicDevice::GraphicDevice
GraphicDevice(const Drawing::Size &s, Drawing::BitmapPtr p={}) ynothrow
构造：指定大小和缓冲区指针。
Definition: YDevice.h:55
YSLib::Devices::GraphicDevice
图形设备。
Definition: YDevice.h:46
platform::KeyInput
std::bitset< KeyBitsetWidth > KeyInput
按键并行位宽。
Definition: Keys.h:67
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:46
CHRLib::s
_tDst const _tSrc * s
Definition: CharacterProcessing.h:143
YModules.h
YSLib 用户界面模块配置文件。
YSLib::ynothrow
YB_PURE const _type size_t n ynothrow
Definition: YCoreUtilities.h:169
YSLib::ImplRet
ImplRet(FetchGlobalInstance().GetGUIHostRef()) YF_API void Execute(GUIApplication &
执行程序主消息循环。
platform::KeyIndex
size_t KeyIndex
按键索引类型：标识特定的按键在按键集合中的位置。
Definition: Keys.h:42
DefSetter
#define DefSetter(_q, _t, _n, _m)
Definition: YBaseMacro.h:252
ystdex
<memory> 特性测试宏。
Definition: ydef.h:1262
YSLib::Drawing::w
The boundary is out of the const Rect SDst w
Definition: YDraw.h:127
YSLib::YB_NONNULL
YB_ATTR_nodiscard YF_API YB_NONNULL(1, 2) ValueNode LoadNPLA1File(const char *disp
载入 NPLA1 配置文件。
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:241
YSLib::Drawing::ConstBitmapPtr
const Pixel * ConstBitmapPtr
Definition: YGraphics.h:44
platform::p
return p p
Definition: YCLib/FileSystem.h:209
const
const Decapsulate const Decapsulate &y ynothrow ContextNode &ctx const
Definition: NPLA1Forms.cpp:1629
platform::bool
YB_ATTR_nodiscard std::FILE *fp bool
Definition: FileIO.h:1271
YSLib::Drawing::BitmapPtr
Pixel * BitmapPtr
Definition: YGraphics.h:42
YSLib::Drawing::GetHeight
YB_ATTR_nodiscard YB_PURE tr GetHeight())) inline PDefH(void
按字体高度和行距调整文本区域的底边距。
ystdex::bases::noncopyable
不可复制对象：禁止派生类调用默认原型的复制构造函数和复制赋值操作符。
Definition: base.h:50
YSLib::Devices::Screen
屏幕。
Definition: YDevice.h:133
YSLib::PDefH
PDefH(Environment &, FetchEnvironment,) ImplRet(FetchGlobalInstance().GetEnvironmentRef()) inline PDefH(GUIHost &
取单一环境对象引用。
YSLib::Devices::KeyInputDevice::Tester
function< bool(const KeyInput &, KeyIndex)> Tester
输入测试器：判断是否在指定索引上激活输入状态。
Definition: YDevice.h:97
ImplThrow
#define ImplThrow(...)
Definition: YBaseMacro.h:105