YSTest  PreAlpha_b500_20140530
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
DSScreen.h
浏览该文件的文档.
1 /*
2  © 2013-2014 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 Inc_Helper_DSScreen_h_
29 #define Inc_Helper_DSScreen_h_ 1
30 
31 #include "Helper/YModules.h"
32 #include YFM_DS_Helper_DSMain // for ScreenWidth, ScreenHeight, Host::Environment;
33 #include YFM_YSLib_Core_YDevice
34 #include YFM_Helper_ScreenBuffer
35 #if YCL_MULTITHREAD == 1
36 # include <mutex>
37 #endif
38 
39 namespace YSLib
40 {
41 
42 namespace Devices
43 {
44 
49 class DSScreen : public Screen
50 {
51 #if YCL_DS
52 public:
53  using BGType = int;
54 
55 private:
56  BGType bg;
57 
58 public:
63  DSScreen(bool) ynothrow;
64 
65  DefGetter(const ynothrow, const BGType&, BgID, bg)
66 
67 
72  void
74 #elif YCL_Win32 || YCL_Android
75 public:
76  Drawing::Point Offset;
82  Host::NativeWindowHandle WindowHandle;
83 
84 private:
87 
88 public:
90  DSScreen(bool) ynothrow;
91 
100  void
102 
104  template<typename _type>
105  void
106  UpdateToSurface(_type& sf)
107  {
108  sf.Update(rbuf, Offset);
109  }
110 #else
111 # error "Unsupported platform found."
112 #endif
113 };
114 
115 
120 inline void
121 InitDSScreen(unique_ptr<DSScreen>& p_up, unique_ptr<DSScreen>& p_dn) ynothrow
122 {
123  try
124  {
125  p_up.reset(new DSScreen(false));
126  p_dn.reset(new DSScreen(true));
127  }
128  catch(...)
129  {
130  throw LoggedEvent("Screen initialization failed.");
131  }
132 }
133 
134 } // namespace Devices;
135 
136 } // namespace YSLib;
137 
138 #endif
139 
pBuffer DefGetter(const ynothrow, const Size &, Size, sGraphics) DefGetter(const ynothrow
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
virtual void Update(Drawing::BitmapPtr) ynothrow
更新。
Definition: ydevice.cpp:47
::ANativeWindow * NativeWindowHandle
Definition: Android.h:50
记录日志的异常事件类。
Definition: yexcept.h:58
PixelType * BitmapPtr
Definition: Video.h:295
void InitDSScreen(unique_ptr< DSScreen > &p_up, unique_ptr< DSScreen > &p_dn) ynothrow
初始化 DS 屏幕。
Definition: DSScreen.h:121
ScreenRegionBuffer(const YSLib::Drawing::Size &, YSLib::SDst)
构造:使用指定的缓冲区大小和像素跨距。 像素跨距小于缓冲区大小。
DS 屏幕。
Definition: DSScreen.h:49