YSTest  PreAlpha_b500_20140530
The YSLib Test Project
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
Helper/Host.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_Host_h_
29 #define INC_Helper_Host_h_ 1
30 
31 #include "YModules.h"
32 #include YFM_Helper_HostWindow // for Host::Window;
33 #if YF_Multithread == 1
34 # include <mutex>
35 # include <atomic>
36 #endif
37 
38 namespace YSLib
39 {
40 
41 #if YF_Hosted
42 namespace Host
43 {
44 
49 class Environment
50 {
51 private:
59  map<NativeWindowHandle, Window*> wnd_map;
64  mutable std::mutex wmap_mtx;
65 # if YF_Multithread == 1
66 
71  std::atomic<size_t> wnd_thrd_count;
72 
73 public:
74 # if YCL_Win32
75 
79  std::atomic<short> RawMouseButton{0};
80 
81 # endif
82 
87  std::atomic<bool> ExitOnAllWindowThreadCompleted{true};
88 
89 private:
90 # if YCL_Win32
91  WindowClass window_class;
93 # endif
94 # endif
95 
96 public:
97  Environment();
98  ~Environment();
99 
105  Window*
106  GetForegroundWindow() const ynothrow;
107 
113  void
114  AddMappedItem(NativeWindowHandle, Window*);
115 
116 # if YF_Multithread == 1
117 
122  void
123  EnterWindowThread()
124  {
125  ++wnd_thrd_count;
126  }
127 # endif
128 
134  Window*
135  FindWindow(NativeWindowHandle) const ynothrow;
136 
141  static void
142  HostLoop();
143 
144 # if YF_Multithread == 1
145 
151  void
152  LeaveWindowThread();
153 # endif
154 
160  void
161  RemoveMappedItem(NativeWindowHandle) ynothrow;
162 
164  void
165  UpdateRenderWindows();
166 };
167 
168 } // namespace Host;
169 #endif
170 
171 } // namespace YSLib;
172 
173 #endif
174 
窗口背景。
Definition: ystyle.h:182
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
::ANativeWindow * NativeWindowHandle
Definition: Android.h:50