-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFPSSystem.cpp
55 lines (44 loc) · 1.1 KB
/
FPSSystem.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "pch.h"
#include "FPSSystem.h"
#include "VisPredComponents.h"
FPSSystem::FPSSystem(std::shared_ptr<SceneManager> scenemanager):System(scenemanager)
{
}
void FPSSystem::BeginRenderUpdate(float deltaTime)
{
}
void FPSSystem::RenderUpdate(float deltaTime)
{
}
void FPSSystem::LateRenderUpdate(float deltaTime)
{
COMPLOOP(FPSComponent, comp)
{
auto ui = comp.GetComponent<TextComponent>();
float text = (1.f / deltaTime);
ui::TextInfo info;
// 소수 첫 번째 자리까지 표시
std::wstringstream stream;
stream << std::fixed << std::setprecision(1) << text;
info.Text = stream.str();
info.FontPath = ui->FontPath;
info.PosXPercent = ui->PosXPercent;
info.PosYPercent = ui->PosYPercent;
info.Color = ui->Color;
info.Scale = ui->Scale;
info.Angle = ui->Angle;
info.Layer = ui->Layer;
if (!comp.IsShow)
info.Color.w = 0;
m_Graphics->UpdateTextObject(ui->GetEntityID(), info);
}
}
void FPSSystem::EditorRenderUpdate(float deltaTime)
{
}
void FPSSystem::Update(float deltaTime)
{
COMPLOOP(FPSComponent, comp)
if (INPUTKEYDOWN(KEYBOARDKEY::F2))
comp.IsShow = !comp.IsShow;
}