Rise
The Vieneo Province
Toggle main menu visibility
Loading...
Searching...
No Matches
Component.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
Condition.h
"
4
#include "
../Rendering/FrameProfiler11.h
"
5
6
class
Component
7
{
8
Bus
*
bus
=
nullptr
;
9
Logger
*
logger
=
nullptr
;
10
DeviceObject
*
pDevice
=
nullptr
;
11
12
public
:
13
std::string
profileName
=
"Component"
;
14
//std::string guid; // not supporting real sensors
15
16
std::string
busval
;
17
18
float
*
ptrValue
=
nullptr
;
19
char
*
chrValue
=
nullptr
;
20
21
//Systems::Fault* ptrFault = nullptr; // not supporting fault flags
22
23
float
bias
= 0.0f;
24
float
modulate
= 1.0f;
25
bool
abs
=
false
;
26
std::vector<Condition>
conditions
;
27
28
Component
(
Bus
* prmBus,
Logger
* prmLogger,
DeviceObject
* prmDevice);
29
void
Update
();
30
void
Render
();
31
};
32
33
inline
Component::Component
(
Bus
* prmBus,
Logger
* prmLogger,
DeviceObject
* prmDevice)
34
{
35
logger
= prmLogger;
36
logger
->
AddToCallStack
(
"Component::ctor"
);
37
bus
= prmBus;
38
pDevice
= prmDevice;
39
}
40
41
inline
void
Component::Update
()
42
{
43
Rendering::ProfileCpuScope11
timing(
profileName
.c_str());
44
logger
->
AddToCallStack
(
"Component::Update"
);
45
46
for
(UINT j = 0; j <
conditions
.size(); j++)
47
{
48
// Draw all the sprites
49
for
(UINT k = 0; k <
conditions
.at(j).sprites.size(); k++)
50
{
51
conditions
.at(j).sprites.at(k).Update();
52
}
53
}
54
}
55
56
inline
void
Component::Render
()
57
{
58
Rendering::ProfileCpuScope11
timing(
profileName
.c_str());
59
logger
->
AddToCallStack
(
"Component::Render"
);
60
61
for
(UINT j = 0; j <
conditions
.size(); j++)
62
{
63
if
(!
ptrValue
||
conditions
.at(j).MeetsCondition(*
ptrValue
))
64
{
65
// Draw all the sprites
66
for
(UINT k = 0; k <
conditions
.at(j).sprites.size(); k++)
67
{
68
conditions
.at(j).sprites.at(k).Draw();
69
}
70
71
// Draw all the text
72
for
(UINT k = 0; k <
conditions
.at(j).text.size(); k++)
73
{
74
if
(
conditions
.at(j).text.at(k).hasVar)
75
{
76
WCHAR str[64];
77
if
(
ptrValue
)
78
{
79
if
(!
abs
)
80
swprintf_s(str, 64,
conditions
.at(j).text.at(k).formattedText, *
ptrValue
*
modulate
+
bias
);
81
else
82
swprintf_s(str, 64,
conditions
.at(j).text.at(k).formattedText, fabsf(*
ptrValue
*
modulate
+
bias
));
83
conditions
.at(j).text.at(k).Draw(str);
84
}
85
else
if
(
chrValue
)
86
{
87
swprintf_s(str, 64,
conditions
.at(j).text.at(k).formattedText,
chrValue
);
88
conditions
.at(j).text.at(k).Draw(str);
89
}
90
else
91
{
92
conditions
.at(j).text.at(k).Draw(
conditions
.at(j).text.at(k).formattedText);
93
}
94
}
95
else
96
{
97
conditions
.at(j).text.at(k).Draw(
conditions
.at(j).text.at(k).formattedText);
98
}
99
}
100
break
;
101
}
102
}
103
}
Condition.h
FrameProfiler11.h
Bus
Definition
Bus.h:20
Component::pDevice
DeviceObject * pDevice
Definition
Component.h:10
Component::Render
void Render()
Definition
Component.h:56
Component::busval
std::string busval
Definition
Component.h:16
Component::profileName
std::string profileName
Definition
Component.h:13
Component::chrValue
char * chrValue
Definition
Component.h:19
Component::Update
void Update()
Definition
Component.h:41
Component::bias
float bias
Definition
Component.h:23
Component::ptrValue
float * ptrValue
Definition
Component.h:18
Component::logger
Logger * logger
Definition
Component.h:9
Component::modulate
float modulate
Definition
Component.h:24
Component::abs
bool abs
Definition
Component.h:25
Component::Component
Component(Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice)
Definition
Component.h:33
Component::bus
Bus * bus
Definition
Component.h:8
Component::conditions
std::vector< Condition > conditions
Definition
Component.h:26
DeviceObject
Definition
DeviceObject.h:8
Logger
Definition
Logger.h:11
Logger::AddToCallStack
void AddToCallStack(const char *msg)
Definition
Logger.cpp:355
Rendering::ProfileCpuScope11
Definition
FrameProfiler11.h:697
Displays
Component.h
Generated on
for Rise by
1.18.0