YSTest: DSScreen.h 源文件

YSTest PreAlpha_b700_20160611 The YSLib Test Project

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

- 文件列表
- 文件成员

DSScreen.h
浏览该文件的文档.
1 /*
2 © 2013-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
29 #ifndef Inc_Helper_DSScreen_h_
30 #define Inc_Helper_DSScreen_h_ 1
31
32 #include "Helper/YModules.h"
33 #include YFM_DS_Helper_DSMain // for ScreenWidth, ScreenHeight;
34 #include YFM_YSLib_Core_YDevice
35 #include YFM_Helper_ScreenBuffer
36 #include YFM_Helper_HostWindow
37
38 namespace YSLib
39 {
40
41 namespace Devices
42 {
43
48 class DSScreen : public Screen
49 {
50 #if YCL_DS
51 public:
52 using BGType = int;
53
54 private:
55 BGType bg;
56
57 public:
62 DSScreen(bool) ynothrow;
63
64 DefGetter(const ynothrow, const BGType&, BgID, bg)
70 DefGetter(const ynothrow, Drawing::BitmapPtr, CheckedBufferPtr,
71 Nonnull(GetBufferPtr()));
72
78 YB_NONNULL(1) void
79 Update(Drawing::ConstBitmapPtr) ynothrow override;
80 #elif YCL_HostedUI
81 public:
82 Drawing::Point Offset;
88 Host::NativeWindowHandle WindowHandle;
89
90 private:
92 Host::ScreenRegionBuffer rbuf;
93
94 public:
96 DSScreen(bool) ynothrow;
97
106 YB_NONNULL(1) void
107 Update(Drawing::ConstBitmapPtr) ynothrow override;
108
110 template<typename _type>
111 void
112 UpdateToSurface(_type& sf)
113 {
114 sf.Update(Deref(rbuf.Lock()), Offset);
115 }
116
118 template<typename _type, typename... _tParams>
119 void
120 UpdateBoundsToSurface(_type& sf, _tParams&&... args)
121 {
122 sf.UpdateBounds(Deref(rbuf.Lock()), yforward(args)...);
123 }
124 #else
125 # error "Unsupported platform found."
126 #endif
127 };
128
129
134 inline void
135 InitDSScreen(unique_ptr<DSScreen>& p_up, unique_ptr<DSScreen>& p_dn) ynothrow
136 {
137 try
138 {
139 p_up.reset(new DSScreen({}));
140 p_dn.reset(new DSScreen(true));
141 }
142 CatchThrow(..., LoggedEvent("Screen initialization failed."))
143 YTraceDe(Notice, "DS screens initialized.");
144 }
145
146 } // namespace Devices;
147
148 } // namespace YSLib;
149
150 #endif
151
platform::Nonnull
_type && Nonnull(_type &&p) ynothrow
断言并返回非空指针。
Definition: Debug.h:411
YSLib::Devices::InitDSScreen
void InitDSScreen(unique_ptr< DSScreen > &p_up, unique_ptr< DSScreen > &p_dn) ynothrow
初始化 DS 屏幕。
Definition: DSScreen.h:135
YSLib::Devices::DSScreen
DS 屏幕。
Definition: DSScreen.h:48
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:45
YSLib::Devices::Screen
屏幕。
Definition: YDevice.h:136
YSLib::LoggedEvent
记录日志的异常事件类。
Definition: YException.h:49
YSLib::Drawing::ConstBitmapPtr
const Pixel * ConstBitmapPtr
Definition: YGraphics.h:44
YTraceDe
#define YTraceDe(...)
YCLib 默认调试跟踪。
Definition: Debug.h:305
YSLib::ynothrow
YB_PURE const _type size_t n ynothrow
Definition: YCoreUtilities.h:168
platform::Deref
yconstfn auto Deref(_type &&p) -> decltype(*p)
断言并解引用非空指针。
Definition: Debug.h:440
YSLib::Drawing::GGraphics::DefGetter
DefGetter(const ynothrow, const PointerType &, BufferPtr, pBuffer) DefGetter(const ynothrow
YSLib::Drawing::BitmapPtr
Pixel * BitmapPtr
Definition: YGraphics.h:42
YSLib::IO::int
YF_API int
Definition: File.h:49
YSLib::YB_NONNULL
YF_API YB_NONNULL(1, 2) ValueNode LoadNPLA1File(const char *disp
载入 NPLA1 配置文件。
YModules.h
yforward
#define yforward(_expr)
根据参数类型使用 std::forward 传递对应参数。
Definition: ydef.h:969
CHRLib::args
_tParams && args
Definition: CharacterProcessing.h:538
platform::Descriptions::Notice
Definition: YCommon.h:158
CatchThrow
#define CatchThrow(_ex,...)
指定抛出指定异常作为异常处理器。
Definition: YBaseMacro.h:141
YSLib::Drawing::GBinaryGroup< SPos >