Rise
The Vieneo Province
Toggle main menu visibility
Loading...
Searching...
No Matches
IndicatedAirSpeed.cpp
Go to the documentation of this file.
1
#include "
../Instrument.h
"
2
#include "
../../Bus.h
"
3
4
IndicatedAirSpeed::IndicatedAirSpeed
(
int
prmX,
int
prmY,
float
prmXScale,
float
prmYScale,
Bus
* prmBus,
Logger
* prmLogger,
DeviceObject
* prmDevice, std::vector<Font*> prmFonts) :
5
Instrument
(prmX, prmY, prmXScale, prmYScale, prmBus, prmLogger, prmDevice, prmFonts)
6
{
7
logger
->
AddToCallStack
(
"IndicatedAirSpeed::ctor"
);
8
defaultFont
= 1;
9
10
tape
=
new
Sprite
(
logger
,
pDevice
,
"Textures/Instruments/iastape.dds"
, prmX+1, prmY, 0.1f, 0, 0, 17, 256, 0xFFFFFFFF);
11
tape
->
mag
= prmXScale;
12
}
13
14
void
IndicatedAirSpeed::Render
()
15
{
16
tape
->
Draw
();
17
}
18
19
void
IndicatedAirSpeed::FrameMove
(
float
fElapsed)
20
{
21
// ias tape
22
const
auto
offsetY =
static_cast<
short
>
(
RiseMath::Max
(0.02f,
bus
->
IndicatedAirspeedKms
) * 500.0f);
// /20*10*1000
23
tape
->
SetRectangle
(179 - offsetY, 0, 17, 256 - offsetY);
24
tape
->
Update
();
25
26
if
(
bus
->
IndicatedAirspeedKms
<= 0.02f && (
playerships
[0].
reference
==
REF_ONGROUND
||
playerships
[0].
mslKm
> 10.0f))
27
airspeedAlive
=
false
;
28
else
if
(!
airspeedAlive
&&
bus
->
IndicatedAirspeedKms
> 0.02f)
29
{
30
airspeedAlive
=
true
;
31
Command
command;
32
command.
name
=
"AuralAirspeedAlive"
;
33
bus
->
commandStream
.emplace_back(command);
34
}
35
36
/*if (playerships[0].reference == REF_ONGROUND)
37
{
38
if (bus->IndicatedAirspeedKms <= 0.02f)
39
{
40
v1 = false;
41
v2 = false;
42
}
43
if (!v1 && bus->IndicatedAirspeedKms > ourcockpit.V1)
44
{
45
v1 = true;
46
Command command;
47
command.name = "AuralV1";
48
bus->commandStream.emplace_back(command);
49
}
50
if (!v2 && bus->IndicatedAirspeedKms > ourcockpit.V2)
51
{
52
v2 = true;
53
Command command;
54
command.name = "AuralV2";
55
bus->commandStream.emplace_back(command);
56
}
57
}*/
58
}
Bus.h
Instrument.h
REF_ONGROUND
@ REF_ONGROUND
Definition
ServerTypes.h:43
Bus
Definition
Bus.h:20
Bus::IndicatedAirspeedKms
float IndicatedAirspeedKms
Definition
Bus.h:34
Bus::commandStream
std::vector< Command > commandStream
Definition
Bus.h:442
DeviceObject
Definition
DeviceObject.h:8
IndicatedAirSpeed::FrameMove
void FrameMove(float fElapsed) override
Definition
IndicatedAirSpeed.cpp:19
IndicatedAirSpeed::IndicatedAirSpeed
IndicatedAirSpeed(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Definition
IndicatedAirSpeed.cpp:4
IndicatedAirSpeed::airspeedAlive
bool airspeedAlive
Definition
Instrument.h:602
IndicatedAirSpeed::tape
Sprite * tape
Definition
Instrument.h:601
IndicatedAirSpeed::Render
void Render() override
Definition
IndicatedAirSpeed.cpp:14
Instrument::bus
Bus * bus
Definition
Instrument.h:22
Instrument::Instrument
Instrument(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Definition
Instrument.h:36
Instrument::logger
Logger * logger
Definition
Instrument.h:23
Instrument::pDevice
DeviceObject * pDevice
Definition
Instrument.h:21
Instrument::defaultFont
UINT defaultFont
Definition
Instrument.h:24
Logger
Definition
Logger.h:11
Logger::AddToCallStack
void AddToCallStack(const char *msg)
Definition
Logger.cpp:355
Sprite::Sprite
Sprite(Logger *prmLogger, DeviceObject *prmpDevice, std::string prmPathAndFilename, int prmX, int prmY, float prmZ, int prmTop, int prmLeft, int prmWidth, int prmHeight, DWORD prmColor, float scaleX=1.0f, float scaleY=1.0f)
Definition
Sprite.cpp:5
Sprite::Draw
void Draw(RiseMath::Color prmColor)
Definition
Sprite.cpp:75
Sprite::Update
void Update()
Definition
Sprite.cpp:50
Sprite::mag
float mag
Definition
Sprite.h:36
Sprite::SetRectangle
void SetRectangle(int top, int left, int right, int bottom)
Definition
Sprite.cpp:105
playerships
s_network_objects playerships[MAX_SCAN]
Definition
globals.cpp:112
RiseMath::Max
constexpr auto Max(A first, B second)
Definition
ClientMath.h:16
Command
Definition
Command.h:6
Command::name
std::string name
Definition
Command.h:11
s_network_objects::mslKm
float mslKm
Definition
globals.h:540
s_network_objects::reference
char reference
Definition
globals.h:508
Instruments
PFD
IndicatedAirSpeed.cpp
Generated on
for Rise by
1.18.0