YSTest: DSScreen.h 源文件

YSTest PreAlpha_b400_20130424 The YSLib Test Project

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

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
DSScreen.h
浏览该文件的文档.
1 ﻿/*
2 Copyright by FrankHB 2013.
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/DSMain.h" // for ScreenWidth, ScreenHeight, Host::Environment;
32 #include "YSLib/Core/ydevice.h"
33 #include "ScreenBuffer.h"
34 #if YCL_MULTITHREAD == 1
35 # include <mutex>
36 #endif
37
38 YSL_BEGIN
39
40 YSL_BEGIN_NAMESPACE(Devices)
41
42
46 class DSScreen : public Screen
47 {
48 #if YCL_DS
49 public:
50 typedef int BGType;
51
52 private:
53 BGType bg;
54
55 public:
60 DSScreen(bool) ynothrow;
61
62 DefGetter(const ynothrow, const BGType&, BgID, bg)
63
64
69 void
70 Update(Drawing::BitmapPtr) ynothrow override;
75 void
76 Update(Drawing::Color = Drawing::Color());
77 #elif YCL_MINGW32
78 public:
79 Drawing::Point Offset;
85 Host::NativeWindowHandle WindowHandle;
86
87 private:
89 Host::ScreenRegionBuffer rbuf;
90
91 public:
93 DSScreen(bool) ynothrow;
94
101 void
102 Update(Drawing::BitmapPtr) ynothrow override;
103
105 template<typename _type>
106 void
107 UpdateToSurface(_type& sf)
108 {
109 sf.Update(rbuf, Offset);
110 }
111 #else
112 # error Unsupported platform found!
113 #endif
114 };
115
116
121 inline void
122 InitDSScreen(unique_ptr<DSScreen>& p_up, unique_ptr<DSScreen>& p_dn) ynothrow
123 {
124 try
125 {
126 p_up.reset(new DSScreen(false));
127 p_dn.reset(new DSScreen(true));
128 }
129 catch(...)
130 {
131 throw LoggedEvent("Screen initialization failed.");
132 }
133 }
134
135 YSL_END_NAMESPACE(Devices)
136
137 YSL_END
138
139 #endif
140