YSTest: Android.h 源文件

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
65 class YF_API WindowReference
66 {
67 protected:
68 NativeWindowHandle hWindow;
69
70 public:
71 WindowReference(NativeWindowHandle h = {})
72 : hWindow(h)
73 {}
74 DefDeCopyCtor(WindowReference)
75 WindowReference(WindowReference&& r) ynothrow
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()})
87 YSLib::SDst
88 GetWidth() const;
89 };
90
91
97 class YF_API HostWindow : private WindowReference, private YSLib::noncopyable
98 {
99 public:
104 // std::map<::UINT, YSLib::GEvent<void(::WPARAM, ::LPARAM)>> MessageMap;
105
106 HostWindow(NativeWindowHandle);
107 DefDelMoveCtor(HostWindow)
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
137 class YF_API ScreenBuffer
138 {
139 private:
144 std::unique_ptr<ScreenBufferData> p_impl;
149 YSLib::SDst width;
150
151 public:
153 ScreenBuffer(const YSLib::Drawing::Size&);
159 ScreenBuffer(const YSLib::Drawing::Size&, YSLib::SDst);
160 ScreenBuffer(ScreenBuffer&&) ynothrow;
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:
213 ScreenRegionBuffer(const YSLib::Drawing::Size&);
219 ScreenRegionBuffer(const YSLib::Drawing::Size&, YSLib::SDst);
220
221 using ScreenBuffer::GetBufferPtr;
223 using ScreenBuffer::GetContext;
224 // using ScreenBuffer::GetNativeHandle;
225 using ScreenBuffer::GetSize;
227 using ScreenBuffer::GetStride;
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&
250 FetchNativeLooper(bool) ythrow(Exception);
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
platform_ex::Android::WindowReference
本机窗口引用。
Definition: Android.h:65
platform_ex::Android::WindowReference::hWindow
NativeWindowHandle hWindow
Definition: Android.h:68
YModules.h
platform_ex::Android::ScreenBuffer::GetContext
const YSLib::Drawing::Graphics & GetContext() const ynothrow
Definition: Android.cpp:141
YF_API
#define YF_API
Definition: Platform.h:64
platform_ex::Android::ScreenBuffer::GetStride
YSLib::SDst GetStride() const ynothrow
Definition: Android.cpp:153
platform_ex::Android::FetchNativeLooper
YF_API::ALooper & FetchNativeLooper(bool) ythrow(Exception)
取当前线程的本机消息循环。
Definition: Android.cpp:220
platform_ex::Android::HostWindow
宿主窗口。
Definition: Android.h:97
platform::SDst
std::uint16_t SDst
屏幕坐标距离。
Definition: Video.h:39
platform_ex::Android::WindowReference::WindowReference
WindowReference(NativeWindowHandle h={})
Definition: Android.h:71
platform_ex::Android::ScreenBuffer::width
YSLib::SDst width
宽：以像素数计量的缓冲区的实际宽度。
Definition: Android.h:149
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:180
ystdex::swap
void swap(any &x, any &y)
交换对象。
Definition: any.h:729
ystdex::noncopyable
不可复制对象：禁止派生类调用默认原型的复制构造函数和复制赋值操作符。
Definition: utility.hpp:75
platform_ex::Android::ScreenBuffer::p_impl
std::unique_ptr< ScreenBufferData > p_impl
Definition: Android.h:144
YSLib::Drawing::Point
GBinaryGroup< SPos > Point
屏幕二维点（直角坐标表示）。
Definition: ygdibase.h:235
platform_ex::Android::TraceConfiguration
YF_API void TraceConfiguration(::AConfiguration &, platform::Logger::Level=platform::Descriptions::Notice)
Definition: Android.cpp:231
YSLib::Exception
std::exception Exception
YSLib 异常基类。
Definition: yexcept.h:44
platform_ex::Android::UpdateFrom
DefGetter(ynothrow, ScreenBuffer &, ScreenBufferRef,*this) using ScreenBuffer voi UpdateFrom)(YSLib::Drawing::BitmapPtr) ynothrow
Definition: Android.h:234
platform_ex::Android::ScreenBuffer
虚拟屏幕缓存。
Definition: Android.h:137
platform::Descriptions::Notice
Definition: ycommon.h:76
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
platform_ex::Android::ScreenBuffer::GetSize
YSLib::Drawing::Size GetSize() const ynothrow
Definition: Android.cpp:147
ythrow
#define ythrow(...)
YSLib 动态异常规范：根据是否使用异常规范宏指定或忽略动态异常规范。
Definition: ydef.h:476
platform_ex::Android::ScreenBuffer::GetBufferPtr
YSLib::Drawing::BitmapPtr GetBufferPtr() const ynothrow
Definition: Android.cpp:135
platform_ex::NativeWindowHandle
::ANativeWindow * NativeWindowHandle
Definition: Android.h:50
platform_ex::Android::ScreenBufferData
Definition: Android.cpp:107
platform_ex::Android::UpdateTo
void UpdateTo(NativeWindowHandle, const YSLib::Drawing::Point &={}) ynothrow
platform::BitmapPtr
PixelType * BitmapPtr
Definition: Video.h:295
YSLib::Drawing::r
bounds & r
Definition: ydraw.h:220
platform_ex::Android::ScreenRegionBuffer
ScreenRegionBuffer(const YSLib::Drawing::Size &, YSLib::SDst)
构造：使用指定的缓冲区大小和像素跨距。 像素跨距小于缓冲区大小。
platform_ex::Android::WindowReference::DefDeCopyCtor
DefDeCopyCtor(WindowReference) WindowReference(WindowReference &&r) ynothrow
Definition: Android.h:74
YSLib::Drawing::Size
屏幕区域大小。
Definition: ygdibase.h:249
DefDelMoveCtor
#define DefDelMoveCtor(_t)
Definition: YBaseMacro.h:143