dl
dl
tool
dl_tool_debug_info.h
浏览该文件的文档.
1
11
#pragma once
12
13
#ifndef DL_DISABLE_RENDER
14
#include <
render/dl_factory.h
>
15
#include <
render/dl_camera.h
>
16
17
namespace
dl::Tool
18
{
19
class
DebugInfo
20
{
21
public
:
26
static
DebugInfo
*
Create
()
27
{
28
DebugInfo
* ret =
new
DebugInfo
;
29
ret->_init();
30
return
ret;
31
}
32
33
gcText
GetText
()
34
{
35
return
_txt;
36
}
37
38
void
Render
(std::string_view str =
""
)
39
{
40
const
RenderInfo2D
ri_2d =
g_system
->GetRenderInfo2D();
41
const
RenderInfo3D
ri_3d =
g_system
->GetRenderInfo3D();
42
43
std::string str_all = fmt::format(
44
"fps:[t_4][c_yellow]{}[c]\n"
45
"dc2d:[t_4][c_yellow]{}+{}[c]\n"
46
"spr:[t_4][c_yellow]{}+{}[c]\n"
47
"order:[t_4][c_yellow]{}[c]\n"
48
"dc3d:[t_4][c_yellow]{}[c]\n"
49
"actor:[t_4][c_yellow]{}[c]\n"
50
"light:[t_4][c_yellow]{}, {}, {}[c]\n"
51
"size:[t_4][c_yellow]{}[c]\n"
52
"mouse:[t_4][c_yellow]{}[c]\n"
53
"camera:[t_4][c_yellow]{}[c]"
,
54
g_time
->GetFPS(),
55
ri_2d.
_numDrawCall
, ri_2d.
_numDrawCallTranslucent
,
56
ri_2d.
_numSprite
, ri_2d.
_numSpriteTranslucent
,
57
g_ui
->GetOrderPickup(),
58
ri_3d.
_numDrawCall
,
59
ri_3d.
_numActor
,
60
ri_3d.
_numLightDir
, ri_3d.
_numLightDot
, ri_3d.
_numLightSpot
,
61
to_string
(
g_system
->GetWindowSize()),
62
to_string
(
g_input
->GetCursorPosition()),
63
to_string
(
g_factory
->GetCamera()->GetPosition()));
64
65
if
(!str.empty())
66
{
67
str_all +=
"\n"
;
68
str_all += str;
69
}
70
_coor->SetScale(
g_ui
->GetScale());
71
_txt->SetString(str_all);
72
_txt->Render();
73
}
74
~DebugInfo
()
75
{
76
delete
_coor;
77
}
78
private
:
79
Coor
* _coor;
80
gcText
_txt;
81
82
void
_init()
83
{
84
_coor =
Coor::Create
();
85
_txt =
g_factory
->CreateText(0, 16,
ColorDef::GREEN
);
86
_txt->
GetCoor
()->
SetParent
(_coor);
87
_txt->
SetBackground
(
true
);
88
_txt->
SetFormat
(
true
);
89
}
90
};
91
92
}
93
#endif
dl::Coor
2d坐标系
定义
dl_coor.h:27
dl::Coor::SetParent
void SetParent(Coor *coor)
dl::Coor::Create
static Coor * Create(Coor *parent=nullptr)
dl::Text::SetFormat
void SetFormat(bool open)
设置是否要格式化字符串(默认为否)
定义
dl_text.h:131
dl::Text::GetCoor
Coor * GetCoor()
返回坐标系
定义
dl_text.h:261
dl::Text::SetBackground
void SetBackground(bool open, const Color &col=ColorDef::TEXT_BG)
设置背景精灵
dl::Tool::DebugInfo
定义
dl_tool_debug_info.h:20
dl::Tool::DebugInfo::GetText
gcText GetText()
定义
dl_tool_debug_info.h:33
dl::Tool::DebugInfo::Render
void Render(std::string_view str="")
定义
dl_tool_debug_info.h:38
dl::Tool::DebugInfo::Create
static DebugInfo * Create()
构造
定义
dl_tool_debug_info.h:26
dl::Tool::DebugInfo::~DebugInfo
~DebugInfo()
定义
dl_tool_debug_info.h:74
dl_camera.h
摄像机(3d)
dl_factory.h
资源工厂
dl::ColorDef::GREEN
constexpr Color GREEN
定义
dl_color.h:282
dl::Tool
定义
dl_tool_archiver.h:23
dl::g_input
Input * g_input
dl::g_factory
Factory * g_factory
dl::to_string
std::string to_string(T v)
to_string包装
定义
dl_string.h:73
dl::gcText
GC< Text > gcText
定义
dl_text.h:365
dl::g_system
System * g_system
dl::g_time
Time * g_time
dl::g_ui
UI::Manager * g_ui
dl::RenderInfo2D
绘图信息2d
定义
dl_type_user.h:20
dl::RenderInfo2D::_numSpriteTranslucent
size_t _numSpriteTranslucent
绘制半透明精灵数量
定义
dl_type_user.h:24
dl::RenderInfo2D::_numDrawCall
size_t _numDrawCall
drawcall数量
定义
dl_type_user.h:21
dl::RenderInfo2D::_numSprite
size_t _numSprite
绘制精灵数量
定义
dl_type_user.h:23
dl::RenderInfo2D::_numDrawCallTranslucent
size_t _numDrawCallTranslucent
半透明drawcall数量
定义
dl_type_user.h:22
dl::RenderInfo3D
绘图信息3d
定义
dl_type_user.h:34
dl::RenderInfo3D::_numLightDir
size_t _numLightDir
平行光
定义
dl_type_user.h:37
dl::RenderInfo3D::_numLightDot
size_t _numLightDot
点光源
定义
dl_type_user.h:38
dl::RenderInfo3D::_numDrawCall
size_t _numDrawCall
drawcall数量
定义
dl_type_user.h:35
dl::RenderInfo3D::_numActor
size_t _numActor
actor数量
定义
dl_type_user.h:36
dl::RenderInfo3D::_numLightSpot
size_t _numLightSpot
聚光灯
定义
dl_type_user.h:39
制作者
1.13.1