dl
首页
相关页面
命名空间
概念
类
文件
文件列表
文件成员
dl
base
dl_array2.h
浏览该文件的文档.
1
13
#pragma once
14
15
16
namespace
dl
17
{
18
19
template
<
typename
T,
size_t
W,
size_t
H>
20
class
Array2
21
{
22
public
:
26
void
Fill
(
const
T
& v)
27
{
28
for
(
auto
& iter : _data)
29
iter = v;
30
}
31
32
std::byte*
GetBuffer
()
33
{
34
return
(std::byte*)_data.data();
35
}
36
37
T
*
GetData
()
38
{
39
return
_data.data();
40
}
41
42
unsigned
GetWidth
()
43
{
44
return
(
unsigned
)
W
;
45
}
46
47
unsigned
GetHeight
()
48
{
49
return
(
unsigned
)
H
;
50
}
51
52
Size
GetSize
()
53
{
54
return
{ (unsigned)
W
, (
unsigned
)
H
};
55
}
56
57
size_t
GetSizeByte
()
58
{
59
return
_data.size() *
sizeof
(
T
);
60
}
61
62
auto
begin
()
63
{
64
return
_data.begin();
65
}
66
auto
end
()
67
{
68
return
_data.end();
69
}
70
private
:
71
std::array<T, W * H> _data;
72
std::array<T*, H> _ptrRow;
73
};
74
75
76
}
dl::Array2
Definition:
dl_array2.h:21
dl::Array2::Fill
void Fill(const T &v)
填充值
Definition:
dl_array2.h:26
dl::Array2::end
auto end()
Definition:
dl_array2.h:66
dl::Array2::GetHeight
unsigned GetHeight()
Definition:
dl_array2.h:47
dl::Array2::GetSizeByte
size_t GetSizeByte()
Definition:
dl_array2.h:57
dl::Array2::begin
auto begin()
Definition:
dl_array2.h:62
dl::Array2::GetData
T * GetData()
Definition:
dl_array2.h:37
dl::Array2::GetBuffer
std::byte * GetBuffer()
Definition:
dl_array2.h:32
dl::Array2::GetWidth
unsigned GetWidth()
Definition:
dl_array2.h:42
dl::Array2::GetSize
Size GetSize()
Definition:
dl_array2.h:52
dl
Definition:
dl_array2.h:17
dl::Size
PointU Size
Definition:
dl_type_def.h:34
dl::KeyCode::W
@ W
dl::KeyCode::T
@ T
dl::KeyCode::H
@ H
制作者
1.9.5