dl
dl
tool
dl_tool_debug_info.h
浏览该文件的文档.
1
11
#pragma once
12
13
#ifndef DL_DISABLE_RENDER
14
15
#include "
render/dl_factory.h
"
16
#include "
render/dl_camera.h
"
17
#include "
system/dl_system.h
"
18
19
namespace
dl::Tool
20
{
21
23
class
DebugInfo
24
{
25
public
:
30
static
DebugInfo
*
Create
()
31
{
32
DebugInfo
* ret =
new
DebugInfo
;
33
ret->_init();
34
return
ret;
35
}
36
37
gcText
GetText
()
38
{
39
return
_txt;
40
}
41
42
void
Render
(std::string_view str =
""
)
43
{
44
const
RenderInfo2D
ri_2d =
g_system
->GetRenderInfo2D();
45
const
RenderInfo3D
ri_3d =
g_system
->GetRenderInfo3D();
46
47
std::string str_all = fmt::format(
48
"fps:[t_4][c_yellow]{}[c]\n"
49
"dc2d:[t_4][c_yellow]{}+{}({})[c]\n"
50
"spr:[t_4][c_yellow]{}+{}[c]\n"
51
"gfx:[t_4][c_yellow]{}[c]\n"
52
"order:[t_4][c_yellow]{}({})[c]\n"
53
"dc3d:[t_4][c_yellow]{}[c]\n"
54
"actor:[t_4][c_yellow]{}[c]\n"
55
"light:[t_4][c_yellow]{}, {}, {}[c]\n"
56
"size:[t_4][c_yellow]{}({})[c]\n"
57
"mouse:[t_4][c_yellow]{}[c]\n"
58
"camera:[t_4][c_yellow]{}[c]"
,
59
g_time
->GetFPS(),
60
ri_2d.
_numDrawCall
, ri_2d.
_numDrawCallTranslucent
, ri_2d.
_numSwitchPso
,
61
ri_2d.
_numSprite
, ri_2d.
_numSpriteTranslucent
,
62
to_string
(
Accumulate::Add
(ri_2d.
_numGfx
)),
63
g_ui
->GetPanelAll().GetSize(),
g_factory
->GetOrderPickup(),
64
ri_3d.
_numDrawCall
,
65
ri_3d.
_numActor
,
66
ri_3d.
_numLightDir
, ri_3d.
_numLightDot
, ri_3d.
_numLightSpot
,
67
to_string
(
g_system
->GetWindowSize()),
to_string
(
g_ui
->GetStandardSize()),
68
to_string
(
g_input
->GetCursorPosition()),
69
to_string
(
g_factory
->GetCamera()->GetPosition()));
70
71
if
(!str.empty())
72
{
73
str_all +=
"\n"
;
74
str_all += str;
75
}
76
_coor->SetScale(
g_ui
->GetScale());
77
_txt->SetString(str_all);
78
_txt->Render();
79
}
80
~DebugInfo
()
81
{
82
delete
_coor;
83
}
84
private
:
85
Coor
* _coor;
86
gcText
_txt;
87
88
void
_init()
89
{
90
_coor =
Coor::Create
();
91
_txt =
g_factory
->CreateText(0, 16,
ColorDef::GREEN
);
92
_txt->
GetCoor
()->
SetParent
(_coor);
93
_txt->
SetBackground
(
true
);
94
_txt->
SetFormat
(
true
);
95
}
96
};
97
98
}
99
#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:260
dl::Text::SetBackground
void SetBackground(bool open, const Color &col=ColorDef::TEXT_BG)
设置背景精灵
dl::Tool::DebugInfo
常见调试信息打印
定义
dl_tool_debug_info.h:24
dl::Tool::DebugInfo::GetText
gcText GetText()
定义
dl_tool_debug_info.h:37
dl::Tool::DebugInfo::Render
void Render(std::string_view str="")
定义
dl_tool_debug_info.h:42
dl::Tool::DebugInfo::Create
static DebugInfo * Create()
构造
定义
dl_tool_debug_info.h:30
dl::Tool::DebugInfo::~DebugInfo
~DebugInfo()
定义
dl_tool_debug_info.h:80
dl_camera.h
摄像机(3d)
dl_factory.h
资源工厂
dl_system.h
窗口主系统
dl::Accumulate::Add
constexpr auto Add(const C &container)
求和sum
定义
dl_range_accumulate.h:24
dl::ColorDef::GREEN
constexpr Color GREEN
定义
dl_color.h:353
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:74
dl::gcText
GC< Text > gcText
定义
dl_text.h:370
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:21
dl::RenderInfo2D::_numSwitchPso
size_t _numSwitchPso
PSO切换次数
定义
dl_type_user.h:26
dl::RenderInfo2D::_numGfx
std::array< size_t, 16 > _numGfx
GFX顶点数
定义
dl_type_user.h:27
dl::RenderInfo2D::_numSpriteTranslucent
size_t _numSpriteTranslucent
绘制半透明精灵数量
定义
dl_type_user.h:25
dl::RenderInfo2D::_numDrawCall
size_t _numDrawCall
drawcall数量
定义
dl_type_user.h:22
dl::RenderInfo2D::_numSprite
size_t _numSprite
绘制精灵数量
定义
dl_type_user.h:24
dl::RenderInfo2D::_numDrawCallTranslucent
size_t _numDrawCallTranslucent
半透明drawcall数量
定义
dl_type_user.h:23
dl::RenderInfo3D
绘图信息3d
定义
dl_type_user.h:39
dl::RenderInfo3D::_numLightDir
size_t _numLightDir
平行光
定义
dl_type_user.h:42
dl::RenderInfo3D::_numLightDot
size_t _numLightDot
点光源
定义
dl_type_user.h:43
dl::RenderInfo3D::_numDrawCall
size_t _numDrawCall
drawcall数量
定义
dl_type_user.h:40
dl::RenderInfo3D::_numActor
size_t _numActor
actor数量
定义
dl_type_user.h:41
dl::RenderInfo3D::_numLightSpot
size_t _numLightSpot
聚光灯
定义
dl_type_user.h:44
制作者
1.13.1