YSTest: YDevice.h 源文件

YSTest PreAlpha_b800_20170810 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

YDevice.h
浏览该文件的文档.
1 /*
2 © 2009-2015 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
33 #include YFM_YSLib_Core_YGraphics
34 #include <ystdex/exception.h> // for ystdex::unsupported;
35
36 namespace YSLib
37 {
38
39 namespace Devices
40 {
41
46 class YF_API GraphicDevice : private noncopyable, protected Drawing::Graphics
47 {
48 public:
50 using Graphics = Drawing::Graphics;
51
56 GraphicDevice(const Drawing::Size& s, Drawing::BitmapPtr p = {}) ynothrow
57 : Graphics(p, s)
58 {}
60 DefDeCopyCtor(GraphicDevice)
62
66 virtual ~GraphicDevice();
67
69
70 using Graphics::operator!;
71
72 using Graphics::operator bool;
74
79 virtual DefGetter(const, unique_ptr<Drawing::IImage>, BackBuffer,
80 unique_ptr<Drawing::IImage>())
82
83 using Graphics::GetHeight;
84 using Graphics::GetWidth;
85 using Graphics::GetSize;
87
89 virtual DefSetter(, const Drawing::Size&, Size, sGraphics)
90 };
91
92
97 class YF_API KeyInputDevice
98 {
99 public:
101 using Tester = std::function<bool(const KeyInput&, KeyIndex)>;
102
103 private:
105 KeyIndex width;
106
107 public:
108 explicit
109 KeyInputDevice(KeyIndex w = KeyBitsetWidth)
110 : width(w)
111 {
112 YAssert(w != 0, "Invalid key input device found.");
113 }
115 DefDeCopyCtor(KeyInputDevice)
117 virtual ~KeyInputDevice();
118
119 DefGetter(const ynothrow, KeyIndex, Width, width)
120
122 virtual PDefH(KeyIndex, Map, KeyIndex code)
123 ImplRet(code < width ? code : 0)
124
126 static PDefH(bool, DefaultTest, const KeyInput& keys, KeyIndex code)
127 ImplRet(code < KeyBitsetWidth ? keys[code] : false)
128 };
129
130
136 class YF_API Screen : public GraphicDevice
137 {
138 public:
143 Screen(const Drawing::Size& s, Drawing::BitmapPtr p = {}) ynothrow
144 : GraphicDevice(s, p)
145 {}
146
153 virtual YB_NONNULL(1) void
154 Update(Drawing::ConstBitmapPtr) ynothrow;
155
157 PDefH(void, SetSize, const Drawing::Size&) override
158 ImplThrow(
159 ystdex::unsupported("The screen does not support alter the size."))
160 };
161
162 } // namespace Devices;
163
164 } // namespace YSLib;
165
166 #endif
167
YSLib::Drawing::GetHeight
tr GetHeight())) inline PDefH(void
按字体高度和行距调整文本区域的底边距。
YSLib::Devices::KeyInputDevice::Tester
std::function< bool(const KeyInput &, KeyIndex)> Tester
输入测试器：判断是否在指定索引上激活输入状态。
Definition: YDevice.h:101
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
YSLib::Drawing::GGraphics
二维图形接口上下文模板。
Definition: YGraphics.h:62
YSLib::Devices::GraphicDevice
图形设备。
Definition: YDevice.h:46
YSLib::Drawing::BitmapPtr
Pixel * BitmapPtr
Definition: YGraphics.h:42
YSLib::YAssert
YAssert(!(v< Deref(a)),"Value less than lower bound found.")
YSLib::Devices::Screen
屏幕。
Definition: YDevice.h:136
YSLib::PDefH
PDefH(Environment &, FetchEnvironment,) ImplRet(FetchGlobalInstance().GetEnvironmentRef()) inline PDefH(GUIHost &
取单一环境对象引用。
YSLib::Devices::Screen::Screen
Screen(const Drawing::Size &s, Drawing::BitmapPtr p={}) ynothrow
构造：指定大小和缓冲区指针。
Definition: YDevice.h:143
YSLib::Drawing::w
The boundary is out of the const Rect SDst w
Definition: YDraw.h:127
CHRLib::s
_tDst const _tSrc * s
Definition: CharacterProcessing.h:140
ystdex
特性测试宏。
Definition: ydef.h:822
YSLib::Drawing::Graphics
GGraphics< BitmapPtr > Graphics
Definition: YGraphics.h:163
YF_API
#define YF_API
Definition: Platform.h:56
Drawing
YSLib::ynothrow
YB_PURE const _type size_t n ynothrow
Definition: YCoreUtilities.h:168
platform::KeyInput
std::bitset< KeyBitsetWidth > KeyInput
按键并行位宽。
Definition: Keys.h:67
platform::KeyIndex
size_t KeyIndex
按键索引类型：标识特定的按键在按键集合中的位置。
Definition: Keys.h:42
exception.h
DefSetter
#define DefSetter(_q, _t, _n, _m)
Definition: YBaseMacro.h:252
YSLib::Devices::KeyInputDevice::width
KeyIndex width
宽度：设备支持的按键编码上界（不含）。
Definition: YDevice.h:105
YSLib::YB_NONNULL
YF_API YB_NONNULL(1, 2) ValueNode LoadNPLA1File(const char *disp
载入 NPLA1 配置文件。
YSLib::ImplRet
ImplRet(FetchGlobalInstance().GetGUIHostRef()) YF_API void Execute(GUIApplication &
执行程序主消息循环。
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:241
YModules.h
DefDeCopyCtor
#define DefDeCopyCtor(_t)
Definition: YBaseMacro.h:162
YSLib::Devices::GraphicDevice::GraphicDevice
GraphicDevice(const Drawing::Size &s, Drawing::BitmapPtr p={}) ynothrow
构造：指定大小和缓冲区指针。
Definition: YDevice.h:56
ystdex::noncopyable
不可复制对象：禁止派生类调用默认原型的复制构造函数和复制赋值操作符。
Definition: base.h:41
YSLib::Drawing::Size
屏幕区域大小。
Definition: YGDIBase.h:293
ystdex::size
auto size(const _tRange &c) -> decltype(c.size())
类容器访问。
Definition: range.hpp:233
YSLib::Devices::KeyInputDevice
按键输入设备。
Definition: YDevice.h:97
YSLib::Devices::KeyInputDevice::KeyInputDevice
KeyInputDevice(KeyIndex w=KeyBitsetWidth)
Definition: YDevice.h:109
ImplThrow
#define ImplThrow(...)
Definition: YBaseMacro.h:105
YSLib::Drawing::ConstBitmapPtr
const Pixel * ConstBitmapPtr
Definition: YGraphics.h:44
CHRLib::p
const auto p(d)