Rise
The Vieneo Province
Toggle main menu visibility
Loading...
Searching...
No Matches
EngineBox.cpp
Go to the documentation of this file.
1
#include "
../Instrument.h
"
2
#include "
../../Bus.h
"
3
4
EngineBox::EngineBox
(
int
prmX,
int
prmY,
float
prmZ,
float
prmXScale,
float
prmYScale,
Bus
* prmBus,
Logger
* prmLogger,
DeviceObject
* prmDevice, std::vector<Font*> prmFonts,
int
prmEngineIndex) :
5
Instrument
(prmX, prmY, prmXScale, prmYScale, prmBus, prmLogger, prmDevice, prmFonts)
6
{
7
if
(prmZ == -1.0f)
8
prmZ = 0.15f;
9
z
= prmZ;
10
11
logger
->
AddToCallStack
(
"EngineBox::ctor"
);
12
defaultFont
= 0;
13
14
engineIndex
= prmEngineIndex;
15
box
=
new
Sprite
(
logger
,
pDevice
,
"Textures/Instruments/engine-textbox.png"
, prmX, prmY, prmZ - 0.05f, 0, 0, 33, 33, 0xFF0C3B5B);
16
swprintf_s(
label
, 5, L
"ENG%i"
,
engineIndex
);
17
}
18
19
void
EngineBox::Render
()
20
{
21
box
->
Draw
();
22
23
DrawTextW(
label
, 8, 10,
z
+ 0.05f, DT_NOCLIP, 0xFFFFFFFF, 3);
24
25
DrawTextW(
percent
, 6, 16,
z
+ 0.05f, DT_NOCLIP,
color
, 1);
26
27
if
(
bus
->
ThrustReverserCommand
[
engineIndex
- 1])
28
{
29
if
((
flasher
> 0.0f &&
oldflasher
<= 0.0f) || (
flasher
> 0.2f &&
oldflasher
<= 0.2f))
30
DrawTextW(L
"REV"
, 9, 0, 0.2f, DT_NOCLIP, 0xFFFFFF00, 1);
31
else
32
DrawTextW(L
"REV"
, 9, 0, 0.2f, DT_NOCLIP, 0xFFC4C400, 1);
33
}
34
}
35
36
void
EngineBox::FrameMove
(
float
)
37
{
38
if
(
engineIndex
>
MAX_ENGINES
)
39
logger
->
Log
(
"EngineBox::FrameMove Engine Index Out-Of-Bounds HIGH"
,
Logger::Level::Fatal
);
40
41
if
(
engineIndex
< 1 ||
42
(
engineIndex
== 1 &&
ourcockpit
.
vdat
.
leftengine
< 64) ||
43
(
engineIndex
== 2 &&
ourcockpit
.
engines
== 2 &&
ourcockpit
.
vdat
.
rightengine
< 64) ||
44
(
engineIndex
== 2 &&
ourcockpit
.
engines
== 3 &&
ourcockpit
.
vdat
.
clengine
< 64) ||
45
(
engineIndex
== 3 &&
ourcockpit
.
engines
== 3 &&
ourcockpit
.
vdat
.
rightengine
< 64) ||
46
engineIndex
>
ourcockpit
.
engines
)
47
{
48
if
((
flasher
> 0.0f &&
oldflasher
<= 0.0f) || (
flasher
> 0.2f &&
oldflasher
<= 0.2f))
49
color
= 0xFFFF0000;
50
else
51
color
= 0xFFC40000;
52
}
53
else
54
color
= 0xFF00FF00;
55
56
if
(fabsf(
bus
->
EngineThrustOutput
[
engineIndex
- 1]) >= 0.9995f)
57
wcscpy_s(
percent
, 5, L
"100%"
);
58
else
59
swprintf_s(
percent
, 5, L
"%04.1f"
, fabsf(
bus
->
EngineThrustOutput
[
engineIndex
- 1]) * 100.0f);
60
}
Bus.h
Instrument.h
MAX_ENGINES
#define MAX_ENGINES
Definition
ServerTypes.h:201
Bus
Definition
Bus.h:20
Bus::EngineThrustOutput
float EngineThrustOutput[MAX_ENGINES]
Definition
Bus.h:54
Bus::ThrustReverserCommand
bool ThrustReverserCommand[MAX_ENGINES]
Definition
Bus.h:72
DeviceObject
Definition
DeviceObject.h:8
EngineBox::Render
void Render() override
Definition
EngineBox.cpp:19
EngineBox::percent
WCHAR percent[5]
Definition
Instrument.h:204
EngineBox::FrameMove
void FrameMove(float fElapsed) override
Definition
EngineBox.cpp:36
EngineBox::engineIndex
int engineIndex
Definition
Instrument.h:201
EngineBox::box
Sprite * box
Definition
Instrument.h:200
EngineBox::color
DWORD color
Definition
Instrument.h:205
EngineBox::z
float z
Definition
Instrument.h:202
EngineBox::label
WCHAR label[5]
Definition
Instrument.h:203
EngineBox::EngineBox
EngineBox(int prmX, int prmY, float prmZ, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts, int prmEngineIndex)
Definition
EngineBox.cpp:4
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::Log
void Log(const char *msg, Level level=Info, int errorCode=0)
Definition
Logger.cpp:283
Logger::AddToCallStack
void AddToCallStack(const char *msg)
Definition
Logger.cpp:355
Logger::Fatal
@ Fatal
Definition
Logger.h:29
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
flasher
float flasher
Definition
globals.cpp:49
ourcockpit
Scockpit ourcockpit
Definition
globals.cpp:114
oldflasher
float oldflasher
Definition
globals.cpp:50
SVesselDC::leftengine
char leftengine
Definition
ServerTypes.h:240
SVesselDC::rightengine
char rightengine
Definition
ServerTypes.h:240
SVesselDC::clengine
char clengine
Definition
ServerTypes.h:240
Scockpit::vdat
SVesselDC vdat
Definition
globals.h:664
Scockpit::engines
char engines
Definition
globals.h:630
Instruments
EICAS
EngineBox.cpp
Generated on
for Rise by
1.18.0