YSTest  PreAlpha_b500_20140530
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
Android.h
浏览该文件的文档.
1 /*
2  © 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 
29 #ifndef YCL_Android_INC_Android_h_
30 #define YCL_Android_INC_Android_h_ 1
31 
32 #include "YCLib/YModules.h"
33 #include YFM_YCLib_Host
34 #if !YCL_Android
35 # error "This file is only for Android."
36 #endif
37 #include <android/native_window.h>
38 #include YFM_YSLib_Core_YGDIBase
39 #include <mutex>
40 
42 struct AConfiguration;
44 struct ALooper;
45 
46 namespace platform_ex
47 {
48 
50 using NativeWindowHandle = ::ANativeWindow*;
51 
56 inline namespace Android
57 {
58 
66 {
67 protected:
69 
70 public:
72  : hWindow(h)
73  {}
76  : hWindow(r.hWindow)
77  {
78  r.hWindow = {};
79  }
80 
81  DefGetter(const ynothrow, NativeWindowHandle, NativeHandle, hWindow)
83  YSLib::SDst
84  GetHeight() const;
85  DefGetter(const, YSLib::Drawing::Size, Size, {GetWidth(), GetHeight()})
88  GetWidth() const;
89 };
90 
91 
98 {
99 public:
104 // std::map<::UINT, YSLib::GEvent<void(::WPARAM, ::LPARAM)>> MessageMap;
105 
108  virtual
109  ~HostWindow();
110 
112  using WindowReference::GetHeight;
113  using WindowReference::GetNativeHandle;
114  using WindowReference::GetSize;
116  using WindowReference::GetWidth;
117 };
118 
119 
124 class ScreenBufferData;
125 
126 
138 {
139 private:
144  std::unique_ptr<ScreenBufferData> p_impl;
150 
151 public:
161  ~ScreenBuffer();
162 
163  ScreenBuffer&
164  operator=(ScreenBuffer&&);
165 
166  YSLib::Drawing::BitmapPtr
167  GetBufferPtr() const ynothrow;
169  const YSLib::Drawing::Graphics&
170  GetContext() const ynothrow;
172  YSLib::Drawing::Size
173  GetSize() const ynothrow;
175  YSLib::SDst
176  GetStride() const ynothrow;
177 
182  void
183  Resize(const YSLib::Drawing::Size&);
184 
191  void
192  UpdateFrom(YSLib::Drawing::BitmapPtr) ynothrow;
193 
195  void
196  swap(ScreenBuffer&) ynothrow;
197 };
198 
203 inline DefSwap(ynothrow, ScreenBuffer)
204 
205 
207 class YF_API ScreenRegionBuffer : private ScreenBuffer
208 {
209 private:
210  std::mutex mtx;
211 
212 public:
220 
224 // using ScreenBuffer::GetNativeHandle;
225  using ScreenBuffer::GetSize;
228  DefGetter(ynothrow, ScreenBuffer&, ScreenBufferRef, *this)
229 
230  using ScreenBuffer::Resize;
231 
233  void
234  UpdateFrom(YSLib::Drawing::BitmapPtr) ynothrow;
235 
237  void
238  UpdateTo(NativeWindowHandle, const YSLib::Drawing::Point& = {}) ynothrow;
239 };
241 
242 
249 YF_API ::ALooper&
251 
252 YF_API void
253 TraceConfiguration(::AConfiguration&,
254  platform::Logger::Level = platform::Descriptions::Notice);
255 
256 } // inline namespace Android;
257 
258 } // namespace platform_ex;
259 
260 #endif
261 
本机窗口引用。
Definition: Android.h:65
const YSLib::Drawing::Graphics & GetContext() const ynothrow
Definition: Android.cpp:141
#define YF_API
Definition: Platform.h:64
YSLib::SDst GetStride() const ynothrow
Definition: Android.cpp:153
YF_API::ALooper & FetchNativeLooper(bool) ythrow(Exception)
取当前线程的本机消息循环。
Definition: Android.cpp:220
std::uint16_t SDst
屏幕坐标距离。
Definition: Video.h:39
WindowReference(NativeWindowHandle h={})
Definition: Android.h:71
YSLib::SDst width
宽:以像素数计量的缓冲区的实际宽度。
Definition: Android.h:149
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:180
void swap(any &x, any &y)
交换对象。
Definition: any.h:729
不可复制对象:禁止派生类调用默认原型的复制构造函数和复制赋值操作符。
Definition: utility.hpp:75
std::unique_ptr< ScreenBufferData > p_impl
Definition: Android.h:144
GBinaryGroup< SPos > Point
屏幕二维点(直角坐标表示)。
Definition: ygdibase.h:235
YF_API void TraceConfiguration(::AConfiguration &, platform::Logger::Level=platform::Descriptions::Notice)
Definition: Android.cpp:231
std::exception Exception
YSLib 异常基类。
Definition: yexcept.h:44
DefGetter(ynothrow, ScreenBuffer &, ScreenBufferRef,*this) using ScreenBuffer voi UpdateFrom)(YSLib::Drawing::BitmapPtr) ynothrow
Definition: Android.h:234
虚拟屏幕缓存。
Definition: Android.h:137
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
YSLib::Drawing::Size GetSize() const ynothrow
Definition: Android.cpp:147
#define ythrow(...)
YSLib 动态异常规范:根据是否使用异常规范宏指定或忽略动态异常规范。
Definition: ydef.h:476
YSLib::Drawing::BitmapPtr GetBufferPtr() const ynothrow
Definition: Android.cpp:135
::ANativeWindow * NativeWindowHandle
Definition: Android.h:50
void UpdateTo(NativeWindowHandle, const YSLib::Drawing::Point &={}) ynothrow
PixelType * BitmapPtr
Definition: Video.h:295
bounds & r
Definition: ydraw.h:220
ScreenRegionBuffer(const YSLib::Drawing::Size &, YSLib::SDst)
构造:使用指定的缓冲区大小和像素跨距。 像素跨距小于缓冲区大小。
DefDeCopyCtor(WindowReference) WindowReference(WindowReference &&r) ynothrow
Definition: Android.h:74
屏幕区域大小。
Definition: ygdibase.h:249
#define DefDelMoveCtor(_t)
Definition: YBaseMacro.h:143