Rise
The Vieneo Province
Loading...
Searching...
No Matches
Displays.cpp
Go to the documentation of this file.
1#include "Displays.h"
2
3#include <clocale>
4#include <codecvt>
5#include <io.h>
6#include <sys/stat.h>
7#include <fcntl.h>
8#include <locale>
9
10void Displays::ConfigureScreens(rapidxml::xml_node<>* xml_node)
11{
12 logger->AddToCallStack("Displays::ConfigureScreens");
13 //xml_attribute<> *exclusiveMode = viewportNode->first_attribute("exclusiveMode");
14 //viewport->exclusiveMode = atoi(exclusiveMode->value()) == 1;
15
16 for (rapidxml::xml_node<>* screenNode = xml_node->first_node(); screenNode; screenNode = screenNode->next_sibling())
17 {
19 Screen screen;
20 switch (screens.size())
21 {
22 case 0: screen = Screen(bus, &ourcockpit.vdat.monitor[0]); break;
23 case 1: screen = Screen(bus, &ourcockpit.vdat.monitor[1]); break;
24 case 2: screen = Screen(bus, &ourcockpit.vdat.monitor[2]); break;
25 case 3: screen = Screen(bus, &ourcockpit.vdat.monitor[3]); break;
26 case 4: screen = Screen(bus, &ourcockpit.vdat.monitor[4]); break;
27 case 5: screen = Screen(bus, &ourcockpit.vdat.monitor[5]); break;
28 case 6: screen = Screen(bus, &ourcockpit.vdat.monitor[6]); break;
29 default: continue;
30 }
31 rapidxml::xml_attribute<>* screenName = screenNode->first_attribute("name");
32 if (screenName)
33 screen.name = screenName->value();
34 rapidxml::xml_attribute<>* bypassVdat = screenNode->first_attribute("bypassVdat");
35 if (bypassVdat)
36 screen.bypassVdat = atoi(bypassVdat->value()) == 1;
37 rapidxml::xml_attribute<>* xAtt = screenNode->first_attribute("x");
38 screen.x = atoi(xAtt->value());
39 rapidxml::xml_attribute<>* yAtt = screenNode->first_attribute("y");
40 screen.y = atoi(yAtt->value());
41 rapidxml::xml_attribute<>* widthAtt = screenNode->first_attribute("width");
42 screen.width = atoi(widthAtt->value());
43 rapidxml::xml_attribute<>* heightAtt = screenNode->first_attribute("height");
44 screen.height = atoi(heightAtt->value());
45 screen.rect.top = screen.y;
46 screen.rect.left = screen.x;
47 screen.rect.right = screen.x + screen.width;
48 screen.rect.bottom = screen.y + screen.height;
49
50 for (rapidxml::xml_node<>* pageNode = screenNode->first_node(); pageNode; pageNode = pageNode->next_sibling())
51 {
52 Page page = Page();
53 rapidxml::xml_attribute<>* pageName = pageNode->first_attribute("name");
54 page.name = pageName->value();
55
56 for (rapidxml::xml_node<>* instrumentOrElementNode = pageNode->first_node(); instrumentOrElementNode;
57 instrumentOrElementNode = instrumentOrElementNode->next_sibling())
58 {
59 if (_strcmpi(instrumentOrElementNode->name(), "Instrument") == 0)
60 {
61 rapidxml::xml_attribute<>* xAtt = instrumentOrElementNode->first_attribute("x");
62 int x = atoi(xAtt->value()) + screen.x;
63 rapidxml::xml_attribute<>* yAtt = instrumentOrElementNode->first_attribute("y");
64 int y = atoi(yAtt->value()) + screen.y;
65 rapidxml::xml_attribute<>* zAtt = instrumentOrElementNode->first_attribute("z");
66 float z = -1.0f;
67 if (zAtt)
68 z = static_cast<float>(atof(zAtt->value()));
69 rapidxml::xml_attribute<>* xScaleAtt = instrumentOrElementNode->first_attribute("xScale");
70 float xScale = xScaleAtt ? static_cast<float>(atof(xScaleAtt->value())) : 1.0f;
71 rapidxml::xml_attribute<>* yScaleAtt = instrumentOrElementNode->first_attribute("yScale");
72 float yScale = yScaleAtt ? static_cast<float>(atof(yScaleAtt->value())) : 1.0f;
73 /*
74 xml_attribute<> *widthAtt = instrumentOrElementNode->first_attribute("width");
75 int width = widthAtt ? atoi(widthAtt->value()) : 0;
76 xml_attribute<> *heightAtt = instrumentOrElementNode->first_attribute("height");
77 int height = heightAtt ? atoi(heightAtt->value()) : 0;
78
79 */
80 rapidxml::xml_attribute<>* typeAtt = instrumentOrElementNode->first_attribute("type");
81 std::string type = typeAtt->value();
82 const auto firstInstrument = page.instruments.size();
83 /*
84 xml_attribute<> *textureAtt = instrumentOrElementNode->first_attribute("texture");
85 std::string texfile = textureAtt ? textureAtt->value() : "";
86 xml_attribute<> *modulateKmAtt = instrumentOrElementNode->first_attribute("modulateKm");
87 float modulateKm = modulateKmAtt ? static_cast<float>(atof(modulateKmAtt->value())) : 1.0f;
88
89 xml_attribute<> *guid1element = instrumentOrElementNode->first_attribute("guid1");
90 std::string guid1 = guid1element ? guid1element->value() : "";
91 xml_attribute<> *guid2element = instrumentOrElementNode->first_attribute("guid2");
92 std::string guid2 = guid2element ? guid2element->value() : "";
93 */
94 rapidxml::xml_attribute<>* ordinalElement = instrumentOrElementNode->first_attribute("ordinal");
95 const int ordinal = ordinalElement ? atoi(ordinalElement->value()) : -1;
96
97 if (type == "CargoManagement") page.instruments.emplace_back(new CargoManagement(x, y, xScale, yScale, bus, logger, pDevice, fonts, screen.rect.bottom - y));
98 if (type == "Intermedia") page.instruments.emplace_back(new Intermedia(x, y, xScale, yScale, bus, logger, pDevice, fonts));
99 if (type == "LineInput")
100 {
101 // Manifest prompts share the footer reserved for its shortcut keys.
102 const int inputY = page.name == "Cargo Manifest" ? screen.y + CargoManifestList(screen.height).controlsY : y;
103 page.instruments.emplace_back(new LineInput(x, inputY, xScale, yScale, bus, logger, pDevice, fonts, page.name));
104 }
105 if (type == "Diagnostics") page.instruments.emplace_back(new Diagnostics(x, y, xScale, yScale, bus, logger, pDevice, fonts));
106 if (type == "Scanner") page.instruments.emplace_back(new Scanner(x, y, xScale, yScale, bus, logger, pDevice, fonts));
107 if (type == "LandingStrut") page.instruments.emplace_back(new LandingStrut(x, y, xScale, yScale, bus, logger, pDevice, fonts, ordinal));
108 if (type == "LandingGear") page.instruments.emplace_back(new LandingGear(x, y, xScale, yScale, bus, logger, pDevice, fonts));
109 if (type == "EngineBox") page.instruments.emplace_back(new EngineBox(x, y, z, xScale, yScale, bus, logger, pDevice, fonts, ordinal));
110 if (type == "EngineBar") page.instruments.emplace_back(new EngineBar(x, y, z, xScale, yScale, bus, logger, pDevice, fonts, ordinal));
111 if (type == "HeadlightBox") page.instruments.emplace_back(new HeadlightBox(x, y, xScale, yScale, bus, logger, pDevice, fonts));
112 if (type == "HeadlightIcon") page.instruments.emplace_back(new HeadlightIcon(x, y, xScale, yScale, bus, logger, pDevice, fonts));
113 if (type == "ElevatorTrim") page.instruments.emplace_back(new ElevatorTrim(x, y, xScale, yScale, bus, logger, pDevice, fonts));
114 if (type == "Flaps") page.instruments.emplace_back(new Flaps(x, y, xScale, yScale, bus, logger, pDevice, fonts));
115 if (type == "AlertMessageStack") page.instruments.emplace_back(new AlertMessageStack(x, y, xScale, yScale, bus, logger, pDevice, fonts));
116 if (type == "MovingMap") page.instruments.emplace_back(new MovingMap(x, y, xScale, yScale, bus, logger, pDevice, fonts));
117 if (type == "TCAS") page.instruments.emplace_back(new TCASOverlay(x, y, xScale, yScale, bus, logger, pDevice, fonts));
118 if (type == "Wind") page.instruments.emplace_back(new Wind(x, y, xScale, yScale, bus, logger, pDevice, fonts));
119 if (type == "FMA") page.instruments.emplace_back(new FMA(x, y, xScale, yScale, bus, logger, pDevice, fonts));
120 if (type == "FMA2") page.instruments.emplace_back(new FMA2(x, y, xScale, yScale, bus, logger, pDevice, fonts));
121 if (type == "Orbit") page.instruments.emplace_back(new Orbit(x, y, xScale, yScale, bus, logger, pDevice, fonts));
122 if (type == "ContactList") page.instruments.emplace_back(new ContactList(x, y, xScale, yScale, bus, logger, pDevice, fonts));
123 if (type == "CarRadio") page.instruments.emplace_back(new CarRadio(x, y, xScale, yScale, bus, logger, pDevice, fonts));
124 if (type == "AttitudeIndicator") page.instruments.emplace_back(new AttitudeIndicator(x, y, xScale, yScale, bus, logger, pDevice, fonts));
125 if (type == "AttitudeIndicator2") page.instruments.emplace_back(new AttitudeIndicator2(x, y, xScale, yScale, bus, logger, pDevice, fonts));
126 if (type == "StreetView")
127 {
128 if (!streetNavigation)
129 streetNavigation = std::make_unique<TurnByTurn>(bus, logger, gui->networking);
130 page.instruments.emplace_back(new StreetView(x, y, xScale, yScale, bus, logger, pDevice, fonts,
131 screen.width, screen.height, streetNavigation.get()));
133 }
134 if (type == "IndicatedAirSpeed") page.instruments.emplace_back(new IndicatedAirSpeed(x, y, xScale, yScale, bus, logger, pDevice, fonts));
135 if (type == "IndicatedAirSpeed2") page.instruments.emplace_back(new IndicatedAirSpeed2(x, y, xScale, yScale, bus, logger, pDevice, fonts));
136 if (type == "RadioAltimeter") page.instruments.emplace_back(new RadioAltimeter(x, y, xScale, yScale, bus, logger, pDevice, fonts));
137 if (type == "Altimeter") page.instruments.emplace_back(new Altimeter(x, y, xScale, yScale, bus, logger, pDevice, fonts));
138 if (type == "Altimeter2") page.instruments.emplace_back(new Altimeter2(x, y, xScale, yScale, bus, logger, pDevice, fonts));
139 if (type == "Compass") page.instruments.emplace_back(new Compass(x, y, xScale, yScale, bus, logger, pDevice, fonts));
140 if (page.instruments.size() > firstInstrument)
141 page.instruments.back()->profileName = type + " #" + std::to_string(firstInstrument + 1);
142 /*
143 if (type == "N1Indicator") page.instruments.emplace_back(new N1Indicator(x, y, xScale, yScale, guid1, guid2, ordinal));
144 if (type == "ITTIndicator") page.instruments.emplace_back(new ITTIndicator(x, y, xScale, yScale, guid1, guid2, ordinal));
145 */
146 }
147 else if (_strcmpi(instrumentOrElementNode->name(), "Element") == 0)
148 {
149 Element element;
150 element.profileName = "Element #" + std::to_string(page.elements.size() + 1);
151 rapidxml::xml_attribute<>* x = instrumentOrElementNode->first_attribute("x");
152 element.x = atoi(x->value()) + screen.x;
153 rapidxml::xml_attribute<>* y = instrumentOrElementNode->first_attribute("y");
154 element.y = atoi(y->value()) + screen.y;
155
156 for (rapidxml::xml_node<>* componentNode = instrumentOrElementNode->first_node(); componentNode; componentNode =
157 componentNode->next_sibling())
158 {
159 Component component = Component(bus, logger, pDevice);
160 rapidxml::xml_attribute<>* busval = componentNode->first_attribute("busval");
161 component.profileName = "Component #" + std::to_string(element.components.size() + 1) +
162 (busval ? " " + std::string(busval->value()) : " static");
163 if (busval)
164 {
165 const std::string type = busval->value();
166 // THESE ARE ONLY FLOATING POINT VALUES SINGLE PRECISION
167 if (type == "DesiredClosingSpeed") component.ptrValue = &bus->AFCS.DesiredClosingSpeed;
168 if (type == "TvmCurrentClosingSpeed") component.ptrValue = &bus->AFCS.TvmCurrentClosingSpeed;
169 if (type == "DesiredRadians") component.ptrValue = &bus->AFCS.DesiredRadians;
170 if (type == "DesiredAltitudeKm") component.ptrValue = &bus->AFCS.DesiredAltitudeKm;
171 if (type == "DesiredVsiKms") component.ptrValue = &bus->AFCS.DesiredVsiKms;
172 if (type == "StaticAirTemperatureCelsius") component.ptrValue = &bus->StaticAirTemperatureCelsius;
173 if (type == "OutsideAirTemperatureKelvin") component.ptrValue = &bus->OutsideAirTemperatureKelvin;
174 if (type == "TotalAirTemperatureCelsius") component.ptrValue = &bus->TotalAirTemperatureCelsius;
175 if (type == "AirframeTemperatureCelsius") component.ptrValue = &bus->AirframeTemperatureCelsius;
176 if (type == "AngleOfAttack") component.ptrValue = &bus->AngleOfAttackRadians;
177 if (type == "GroundSpeed") component.ptrValue = &bus->GroundSpeedKms;
178 if (type == "Speedometer") component.ptrValue = &bus->SpeedometerKPH;
179 if (type == "Latitude") component.ptrValue = &bus->LatitudeDeg;
180 if (type == "Longitude") component.ptrValue = &bus->LongitudeDeg;
181 if (type == "VerticalSpeed") component.ptrValue = &bus->VerticalSpeedKms;
182 if (type == "DynamicPressure") component.ptrValue = &bus->DynPresFwdLbsPerSqFt;
183 if (type == "LinearVelocity") component.ptrValue = &bus->LinearVelocityKms;
184 if (type == "Mach") component.ptrValue = &bus->Mach;
185 if (type == "SpeedOfSoundKms") component.ptrValue = &bus->SpeedOfSoundKms;
186 if (type == "EmptyWeight") component.ptrValue = &bus->EmptyWeightLbs;
187 if (type == "FuelWeight") component.ptrValue = &bus->FuelWeightLbs;
188 if (type == "FuelFlow") component.ptrValue = &bus->FuelFlowKgh;
189 if (type == "PayloadWeight") component.ptrValue = &bus->PayloadWeightLbs;
190 if (type == "PitchTrim") component.ptrValue = &bus->PitchTrimScalar;
191 if (type == "NormalAcceleration.x") component.ptrValue = &bus->NormalAcceleration.x;
192 if (type == "NormalAcceleration.y") component.ptrValue = &bus->NormalAcceleration.y;
193 if (type == "NormalAcceleration.z") component.ptrValue = &bus->NormalAcceleration.z;
194 if (type == "PressureAltitude") component.ptrValue = &bus->PressureAltitudeKm;
195 if (type == "RadioAltitude") component.ptrValue = &bus->RadioAltitudeKm;
196 if (type == "HeadingTrue") component.ptrValue = &bus->HeadingTrueDegrees;
197 if (type == "HeadingTrack") component.ptrValue = &bus->HeadingTrackDegrees;
198 if (type == "HeadingMagnetic") component.ptrValue = &bus->HeadingMagneticDegrees;
199 if (type == "TrueAirspeedKms") component.ptrValue = &bus->TrueAirspeedKms;
200 if (type == "IndicatedAirspeedKms") component.ptrValue = &bus->IndicatedAirspeedKms;
201 if (type == "MapScale") component.ptrValue = &bus->MapScaleInnerRingKm;
202 if (type == "WindSpeedMs") component.ptrValue = &bus->WindSpeedMs;
203 if (type == "WindDirectionDegrees") component.ptrValue = &bus->WindDirectionDegrees;
204 if (type == "GlideslopeDeviation") component.ptrValue = &bus->GlideslopeDeviationRadians;
205 if (type == "LocalTimeHours") component.ptrValue = &bus->LocalTimeHours;
206 if (type == "LocalTimeMinutes") component.ptrValue = &bus->LocalTimeMinutes;
207 if (type == "TargetDistanceKm") component.ptrValue = &bus->TargetDistanceKm;
208 if (type == "TargetBearingDeg") component.ptrValue = &bus->TargetBearingDeg;
209 if (type == "CabinPressureMb") component.ptrValue = &bus->CabinPressureMb;
210 if (type == "PressureDiffMb") component.ptrValue = &bus->PressureDiffMb;
211 if (type == "StaticAirPressureMb") component.ptrValue = &bus->StaticAirPressureMb;
212 if (type == "PitchAttitudeRadians") component.ptrValue = &bus->PitchAttitudeRadians;
213 if (type == "YawDamperCommand") component.ptrValue = &bus->YawDamperCommand;
214 if (type == "YawCommand") component.ptrValue = &playerships[0].yawdeflect;
215
216 // THESE ARE CHRVALUE
217 if (type == "IVR") component.chrValue = &playerships[0].IVR[0];
218 if (type == "TimeToNextFix") component.chrValue = &bus->TimeToNextFix[0];
219 if (type == "GearShift") component.chrValue = &bus->gearShift[0];
220 }
221
222 rapidxml::xml_attribute<>* modulate = componentNode->first_attribute("modulate");
223 if (modulate) component.modulate = static_cast<float>(atof(modulate->value()));
224 rapidxml::xml_attribute<>* bias = componentNode->first_attribute("bias");
225 if (bias) component.bias = static_cast<float>(atof(bias->value()));
226 rapidxml::xml_attribute<>* abs = componentNode->first_attribute("abs");
227 if (abs) component.abs = atoi(abs->value());
228
229 for (rapidxml::xml_node<>* conditionNode = componentNode->first_node(); conditionNode; conditionNode =
230 conditionNode->next_sibling())
231 {
232 Condition condition;
233 rapidxml::xml_attribute<>* min = conditionNode->first_attribute("min");
234 if (min) condition.min = static_cast<float>(atof(min->value()));
235 rapidxml::xml_attribute<>* max = conditionNode->first_attribute("max");
236 if (max) condition.max = static_cast<float>(atof(max->value()));
237
238 for (rapidxml::xml_node<>* spriteOrTextNode = conditionNode->first_node(); spriteOrTextNode; spriteOrTextNode =
239 spriteOrTextNode->next_sibling())
240 {
241 if (_strcmpi(spriteOrTextNode->name(), "Sprite") == 0)
242 {
243 std::string pathAndFilename = spriteOrTextNode->value();
244 rapidxml::xml_attribute<>* spriteX = spriteOrTextNode->first_attribute("x");
245 int x = atoi(spriteX->value()) + element.x;
246 rapidxml::xml_attribute<>* spriteY = spriteOrTextNode->first_attribute("y");
247 int y = atoi(spriteY->value()) + element.y;
248 rapidxml::xml_attribute<>* zAttr = spriteOrTextNode->first_attribute("z");
249 float z = 0.0f; // bottom of render order
250 if (zAttr) z = static_cast<float>(atof(zAttr->value()));
251
252 rapidxml::xml_attribute<>* spriteTop = spriteOrTextNode->first_attribute("top");
253 int top = 0;
254 if (spriteTop) top = atoi(spriteTop->value());
255 rapidxml::xml_attribute<>* spriteLeft = spriteOrTextNode->first_attribute("left");
256 int left = 0;
257 if (spriteLeft) left = atoi(spriteLeft->value());
258 rapidxml::xml_attribute<>* widthAttr = spriteOrTextNode->first_attribute("width");
259 int width = atoi(widthAttr->value());
260 rapidxml::xml_attribute<>* heightAttr = spriteOrTextNode->first_attribute("height");
261 int height = atoi(heightAttr->value());
262
263 rapidxml::xml_attribute<>* colorAttr = spriteOrTextNode->first_attribute("color");
264 DWORD color = 0xFFFFFFFF;
265 if (colorAttr) color = strtoul(colorAttr->value(), nullptr, 16);
266
267 float scaleX = 1.0f;
268 rapidxml::xml_attribute<>* scaleXAttr = spriteOrTextNode->first_attribute("xScale");
269 if (scaleXAttr) scaleX = static_cast<float>(atof(scaleXAttr->value()));
270 float scaleY = 1.0f;
271 rapidxml::xml_attribute<>* scaleYAttr = spriteOrTextNode->first_attribute("yScale");
272 if (scaleYAttr) scaleY = static_cast<float>(atof(scaleYAttr->value()));
273
274 //rapidxml::xml_attribute<> *name = spriteOrTextNode->first_attribute("name");
275 //if (name) sprite.elementName = name->value();
276 //rapidxml::xml_attribute<> *hidden = spriteOrTextNode->first_attribute("hidden");
277 //if (hidden) sprite.normallyHidden = atoi(hidden->value()) == 1;
278
279 const Sprite sprite = Sprite(logger, pDevice, pathAndFilename, x, y, z, top, left, width, height, color, scaleX, scaleY);
280
281 condition.sprites.emplace_back(sprite);
282 }
283 else if (_strcmpi(spriteOrTextNode->name(), "Text") == 0)
284 {
285 rapidxml::xml_attribute<>* textX = spriteOrTextNode->first_attribute("x");
286 int x = atoi(textX->value()) + element.x;
287 rapidxml::xml_attribute<>* textY = spriteOrTextNode->first_attribute("y");
288 int y = atoi(textY->value()) + element.y;
289 rapidxml::xml_attribute<>* font = spriteOrTextNode->first_attribute("font");
290
291 rapidxml::xml_attribute<>* widthAttr = spriteOrTextNode->first_attribute("width");
292 int width = 0;
293 if (widthAttr) width = atoi(widthAttr->value());
294 rapidxml::xml_attribute<>* heightAttr = spriteOrTextNode->first_attribute("height");
295 int height = 0;
296 if (heightAttr) height = atoi(heightAttr->value());
297
298 int fontInt = 0;
299 if (font) fontInt = atoi(font->value());
300 if (fontInt >= (int)fonts.size() || fontInt < 0)
301 {
302 throw std::exception("Font requested is not in available fonts list!");
303 }
304
305 Text text = Text(logger, bus, pDevice, fonts.at(fontInt)->pFont, x, y, width, height);
306 std::string rawText = spriteOrTextNode->value();
307 if (rawText.length() >= 32)
308 {
309 logger->Log("Text element in display XML is too long!", Logger::Level::Fatal);
310 }
311
312 std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
313 wcscpy_s(text.formattedText, 32, converter.from_bytes(rawText).c_str());
314
315
316 // std::size_t found;
317 //do
318 //{
319 // // we tried changing the encoding from utf-8 to iso-8559-1 but nothing worked to delete the &nbsp; hatted weird "A"
320 // found = temptext.find(-62);
321 // if (found != std::string::npos)
322 // temptext.erase(found, 1);
323 //} while (found != std::string::npos);
324
325 if (rawText.find('%') != std::string::npos)
326 text.hasVar = true;
327
328 //UTF8_to_WChar(text.formattedText, temptext.c_str());
329
330 rapidxml::xml_attribute<>* align = spriteOrTextNode->first_attribute("align");
331 if (align)
332 {
333 if (_strcmpi(align->value(), "left") == 0) text.flags |= DT_LEFT;
334 if (_strcmpi(align->value(), "center") == 0) text.flags |= DT_CENTER;
335 if (_strcmpi(align->value(), "right") == 0) text.flags |= DT_RIGHT;
336 }
337
338 rapidxml::xml_attribute<>* valign = spriteOrTextNode->first_attribute("valign");
339 if (valign)
340 {
341 if (_strcmpi(valign->value(), "top") == 0) text.flags |= DT_TOP;
342 if (_strcmpi(valign->value(), "center") == 0) text.flags |= DT_VCENTER;
343 if (_strcmpi(valign->value(), "bottom") == 0) text.flags |= DT_BOTTOM;
344 }
345
346 rapidxml::xml_attribute<>* color = spriteOrTextNode->first_attribute("color");
347 text.color = strtoul(color->value(), nullptr, 16);
348
349 condition.text.emplace_back(text);
350 }
351 }
352
353 component.conditions.emplace_back(condition);
354 }
355
356 element.components.emplace_back(component);
357 }
358
359 page.elements.emplace_back(element);
360 }
361 }
362 screen.pages.emplace_back(page);
363 }
364
365 screens.emplace_back(screen);
366 }
367}
368
369void Displays::ConfigureParams(rapidxml::xml_node<>* xml_node)
370{
371 logger->AddToCallStack("Displays::ConfigureParams");
372 for (rapidxml::xml_node<>* fontNode = xml_node->first_node(); fontNode; fontNode = fontNode->next_sibling())
373 {
374 rapidxml::xml_attribute<>* name = fontNode->first_attribute("name");
375 std::string iname = name->value();
376 std::string ipathAndFilename = fontNode->value();
377 if (iname == "PitchAggressionFactorEmpty")
378 ourcockpit.appitagr = static_cast<float>(atof(fontNode->value()));
379 if (iname == "RollAggressionFactorEmpty")
380 ourcockpit.aprolagr = static_cast<float>(atof(fontNode->value()));
381 if (iname == "YawAggressionFactorEmpty")
382 ourcockpit.apYawTurnCoordination = static_cast<float>(atof(fontNode->value()));
383 if (iname == "PitchDegreesToAddIn30DegreeBankEmpty")
384 ourcockpit.pitchToAddInTurn = RiseMath::ToRadian(static_cast<float>(atof(fontNode->value())));
385 if (iname == "Vs2Kms")
386 ourcockpit.Vs2 = static_cast<float>(atof(fontNode->value()));
387 if (iname == "VcKmsAtMSL")
388 ourcockpit.VcMSL = static_cast<float>(atof(fontNode->value()));
389 if (iname == "VneKmsEmpty")
390 ourcockpit.VneEmpty = static_cast<float>(atof(fontNode->value()));
391 if (iname == "VneKmsMaxGross")
392 ourcockpit.VneMaxGross = static_cast<float>(atof(fontNode->value()));
393 if (iname == "VrKmsEmpty")
394 ourcockpit.VrEmpty = static_cast<float>(atof(fontNode->value()));
395 if (iname == "VrKmsMaxGross")
396 ourcockpit.VrMaxGross = static_cast<float>(atof(fontNode->value()));
397 if (iname == "TrimTargetEmpty")
398 ourcockpit.trimTargetEmpty = static_cast<float>(atof(fontNode->value()));
399 if (iname == "TrimTargetMaxGross")
400 ourcockpit.trimTargetMaxGross = static_cast<float>(atof(fontNode->value()));
401 if (iname == "TrimTolerance")
402 ourcockpit.trimTolerance = static_cast<float>(atof(fontNode->value()));
403 if (iname == "Vle")
404 ourcockpit.Vle = static_cast<float>(atof(fontNode->value()));
405 if (iname == "MaxDoorOpenOperatingKms")
406 ourcockpit.MaxDoorOpenOperatingKms = static_cast<float>(atof(fontNode->value()));
407
408 // @todo remove after we determine this number
409 if (gui->IsAdmin && iname == "HorizontalStabilizerAngleOfIncidenceDegrees")
410 ourcockpit.hStabAngleOfIncidenceRad = RiseMath::ToRadian(static_cast<float>(atof(fontNode->value())));
411 }
412}
413
414void Displays::ConfigureFonts(rapidxml::xml_node<>* xml_node)
415{
416 logger->AddToCallStack("Displays::ConfigureFonts");
417 for (rapidxml::xml_node<>* fontNode = xml_node->first_node(); fontNode; fontNode = fontNode->next_sibling())
418 {
419 rapidxml::xml_attribute<>* width = fontNode->first_attribute("width");
420 int iwidth = atoi(width->value());
421 rapidxml::xml_attribute<>* height = fontNode->first_attribute("height");
422 int iheight = atoi(height->value());
423 rapidxml::xml_attribute<>* name = fontNode->first_attribute("name");
424 std::string iname = name->value();
425 std::string ipathAndFilename = fontNode->value();
426
427 // fonts.emplace_back(Font(logger, DXUTGetD3D10Device(), iwidth, iheight, iname, ipathAndFilename));
428 fonts.emplace_back(new Font(logger, Rendering::ClientRenderer(), iwidth, iheight, iname, ipathAndFilename));
429 }
430}
431
433{
434 logger->AddToCallStack("Displays::DeviceCreation");
435
437 if (!direct3DDevice)
438 {
439 logger->Log("Displays::DeviceCreation could not obtain the DXUT Direct3D device", Logger::Level::Error);
440 return;
441 }
442
443 scissorSupported = true; // Required by the native D3D11 feature level.
444
445 //pDevice = new DeviceObject(logger, DXUTGetD3D10Device());
446 pDevice = new DeviceObject(direct3DDevice, logger);
448 renderFailureLogged = false;
449
450 char deviceMsg[199];
451 sprintf_s(deviceMsg, sizeof deviceMsg,
452 "Displays::DeviceCreation created device generation %u wrapper %p D3D9 %p sprite %p scissor %i",
453 deviceGeneration, static_cast<void*>(pDevice), static_cast<void*>(direct3DDevice),
454 static_cast<void*>(pDevice->pSprite), scissorSupported);
455 logger->Log(deviceMsg);
456
457 screens.clear();
458
459 setlocale(LC_ALL, "English_United States.1252");
460 //setlocale(LC_ALL, ".65001"); // did not work for Ionic Potuguese
461
462 WCHAR configFilePath[MAX_PATH];
463 switch (ourcockpit.texturelib)
464 {
465 case VehicleType::C98:
466 wcscpy_s(configFilePath, MAX_PATH, L"Displays\\C-98.xml");
467 break;
468 case VehicleType::E10:
469 wcscpy_s(configFilePath, MAX_PATH, L"Displays\\E-10.xml");
470 break;
471 case VehicleType::P13:
472 wcscpy_s(configFilePath, MAX_PATH, L"Displays\\P-13.xml");
473 break;
474 case VehicleType::A4:
475 wcscpy_s(configFilePath, MAX_PATH, L"Displays\\A-4.xml");
476 break;
477 case VehicleType::C2:
478 wcscpy_s(configFilePath, MAX_PATH, L"Displays\\C-2.xml");
479 break;
481 wcscpy_s(configFilePath, MAX_PATH, L"Displays\\T-120.xml");
482 break;
484 wcscpy_s(configFilePath, MAX_PATH, L"Displays\\EVA.xml");
485 break;
487 wcscpy_s(configFilePath, MAX_PATH, L"Displays\\T-121.xml");
488 break;
489 case VehicleType::E11:
490 wcscpy_s(configFilePath, MAX_PATH, L"Displays\\E-11.xml");
491 break;
492 case VehicleType::C2A:
493 wcscpy_s(configFilePath, MAX_PATH, L"Displays\\C-2A.xml");
494 break;
496 wcscpy_s(configFilePath, MAX_PATH, L"Displays\\W-6.xml");
497 break;
498 case VehicleType::T19:
499 wcscpy_s(configFilePath, MAX_PATH, L"Displays\\T-19.xml");
500 break;
501 case VehicleType::T27:
502 wcscpy_s(configFilePath, MAX_PATH, L"Displays\\T-27.xml");
503 break;
505 wcscpy_s(configFilePath, MAX_PATH, L"Displays\\Apartment.xml");
506 break;
508 wcscpy_s(configFilePath, MAX_PATH, L"Displays\\ControlTower.xml");
509 break;
510 default:
511 return;
512 }
513
514 int configFile;
515 _wsopen_s(&configFile, configFilePath, _O_RDONLY | _O_BINARY | _O_SEQUENTIAL, SH_DENYWR, S_IREAD);
516 if (configFile == -1)
517 {
518 char msg[99];
519 sprintf_s(msg, sizeof msg, "Config::Initialize could not open file: %S", configFilePath);
520 logger->Log(msg, Logger::Error, errno);
521 return;
522 }
523
524 // had to do as dynamic char array because it wouldn't take a std::string
525 const int fileLength = _filelength(configFile);
526 char* buffer = new char[fileLength + 1]; // null terminator
527 _read(configFile, buffer, fileLength);
528 _close(configFile);
529 buffer[fileLength] = 0; // null terminate
530
531 rapidxml::xml_document<> doc; // character type defaults to char
532 try
533 {
534 doc.parse<0>(buffer); // 0 means default parse flags
535 }
536 catch (...)
537 {
538 SAFE_DELETE_ARRAY(buffer);
539 char msg[99];
540 sprintf_s(msg, sizeof msg, "Config::Initialize exception parsing file: %S", configFilePath);
541 logger->Log(msg, Logger::Error, errno);
542 return;
543 }
544
545 rapidxml::xml_node<>* rootNode = doc.first_node("Displays");
546
547 rapidxml::xml_node<>* fontsNode = rootNode->first_node("Fonts");
548 ConfigureFonts(fontsNode);
549
550 rapidxml::xml_node<>* screensNode = rootNode->first_node("Screens");
551 ConfigureScreens(screensNode);
552
553 rapidxml::xml_node<>* paramsNode = rootNode->first_node("Params");
554 if (paramsNode)
555 ConfigureParams(paramsNode);
556
557 SAFE_DELETE_ARRAY(buffer);
558
559 gui->SetLocale();
560}
561
563{
564 logger->AddToCallStack("Displays::ChangeCockpit");
565
566 OnDestroyDevice("cockpit change");
568}
569
571{
573 logger->AddToCallStack("Displays::Render");
574
575 if (!pDevice || !pDevice->GetD3DDevice() || !pDevice->pSprite)
576 {
578 {
579 char msg[255];
580 sprintf_s(msg, sizeof msg,
581 "Displays::Render unavailable: generation %u wrapper %p D3D9 %p sprite %p scissor %i",
582 deviceGeneration, static_cast<void*>(pDevice),
583 pDevice ? static_cast<void*>(pDevice->GetD3DDevice()) : nullptr,
584 pDevice ? static_cast<void*>(pDevice->pSprite) : nullptr, scissorSupported);
586 renderFailureLogged = true;
587 }
588 return;
589 }
590
591 bool scissorEnabled = false;
592 HRESULT hr = S_OK;
594 {
595 logger->AddToCallStack("Displays::Render enable scissor");
597 if (FAILED(hr))
598 {
600 {
601 logger->Log("Displays::Render could not enable scissor testing; rendering without clipping",
603 renderFailureLogged = true;
604 }
605 }
606 else
607 scissorEnabled = true;
608 }
609
610 logger->AddToCallStack("Displays::Render sprite Begin");
611 hr = pDevice->BeginSprites();
612 if (FAILED(hr))
613 {
615 {
616 logger->Log("Displays::Render could not begin the display sprite", Logger::Level::Error, hr);
617 renderFailureLogged = true;
618 }
619 if (scissorEnabled)
621 return;
622 }
623
624 for (UINT i = 0; i < screens.size(); i++)
625 {
626 char stackMsg[80];
627 const Screen& screen = screens.at(i);
628 Rendering::ProfileCpuScope11 screenTiming("Screen", screen.name.c_str());
629 const char* pageName = screen.currentPage < screen.pages.size()
630 ? screen.pages.at(screen.currentPage).name.c_str()
631 : "<invalid>";
632 sprintf_s(stackMsg, sizeof stackMsg, "Displays::Render screen %u %.20s page %u %.20s",
633 i, screen.name.c_str(), screen.currentPage, pageName);
634 logger->AddToCallStack(stackMsg);
635
636 if (scissorEnabled)
637 {
638 hr = pDevice->SetScissorRect(&screens.at(i).rect);
639 if (FAILED(hr) && !renderFailureLogged)
640 {
641 logger->Log("Displays::Render could not set a scissor rectangle; rendering without clipping",
643 renderFailureLogged = true;
644 }
645 }
646 const bool rendered = screens.at(i).Render();
647
648 sprintf_s(stackMsg, sizeof stackMsg, "Displays::Render screen %u Render DONE %i", i, rendered);
649 logger->AddToCallStack(stackMsg);
650 if (rendered)
651 {
652 sprintf_s(stackMsg, sizeof stackMsg, "Displays::Render screen %u Flush", i);
653 logger->AddToCallStack(stackMsg);
654 V(pDevice->pSprite->Flush());
655 sprintf_s(stackMsg, sizeof stackMsg, "Displays::Render screen %u Flush DONE", i);
656 logger->AddToCallStack(stackMsg);
657 }
658 }
659
660 logger->AddToCallStack("Displays::Render sprite End");
661 V(pDevice->pSprite->End());
662
663 if (scissorEnabled)
664 {
665 logger->AddToCallStack("Displays::Render disable scissor");
667 if (FAILED(hr) && !renderFailureLogged)
668 {
669 logger->Log("Displays::Render could not disable scissor testing", Logger::Level::Error, hr);
670 renderFailureLogged = true;
671 }
672 }
673
674 logger->AddToCallStack("Displays::Render DONE");
675}
676
677void Displays::FrameMove(float fElapsed)
678{
679 logger->AddToCallStack("Displays::FrameMove");
680 for (UINT i = 0; i < bus->commandStream.size(); i++)
681 {
682 const Command command = bus->commandStream.at(i);
683
684 if (command.name == "ChangeMfdPage")
685 {
686 ChangePage("MFD", command.sValue);
687 bus->commandStream.erase(bus->commandStream.begin() + i);
688 }
689 else if (command.name == "RestorePage")
690 {
691 RestorePage(command.sValue);
692 bus->commandStream.erase(bus->commandStream.begin() + i);
693 }
694 }
695
696 for (UINT i = 0; i < screens.size(); i++)
697 screens.at(i).FrameMove(fElapsed);
698 // One guidance processor per equipped cockpit, including while another page is selected.
700 streetNavigation->Update(playerships[0].groundvehicle, fElapsed);
701}
702
703bool Displays::HandleKeyPress(short key, bool shift)
704{
705 logger->AddToCallStack("Displays::HandleKeyPress");
706 for (UINT i = 0; i < screens.size(); i++)
707 {
708 if (screens.at(i).HandleKeyPress(key, shift))
709 return true;
710 }
711 return false;
712}
713
714bool Displays::UpdateKeyRepeat(const unsigned char* keys, bool shift, float elapsed)
715{
716 bool handled = false;
717 for (auto& screen : screens)
718 if (screen.UpdateKeyRepeat(keys, shift, elapsed)) handled = true;
719 return handled;
720}
721
723{
724 logger->AddToCallStack("Displays::OnLostDevice");
727 if (pDevice)
729 for (UINT i = 0; i < fonts.size(); i++)
730 fonts.at(i)->pFont->OnLostDevice();
731}
732
734{
735 logger->AddToCallStack("Displays::OnResetDevice");
736 if (!pDevice)
737 {
738 logger->Log("Displays::OnResetDevice recreating destroyed display device");
740 return;
741 }
742
746 for (UINT i = 0; i < fonts.size(); i++)
747 fonts.at(i)->pFont->OnResetDevice();
748}
749
750void Displays::ChangePage(std::string screenName, std::string pageName)
751{
752 logger->AddToCallStack("Displays::ChangePage");
753 char msg[99];
754
755 for (UINT i = 0; i < screens.size(); i++)
756 {
757 if (screens.at(i).name == screenName)
758 {
759 if (screens.at(i).ChangePage(pageName))
760 return;
761
762 sprintf_s(msg, sizeof msg, "Displays::ChangePage found screen %s but couldn't find page: %s", screenName.c_str(),
763 pageName.c_str());
764 logger->Log(msg, Logger::Warn);
765 }
766 }
767
768 sprintf_s(msg, sizeof msg, "Displays::ChangePage could not find screen named: %s", screenName.c_str());
769 logger->Log(msg, Logger::Warn);
770}
771
772// If you call this you are responsible for updating the server (except if it is coming FROM the server)
773void Displays::ChangePage(std::string screenName, int pageNumber)
774{
775 logger->AddToCallStack("Displays::ChangePage");
776 char msg[99];
777
778 for (UINT i = 0; i < screens.size(); i++)
779 {
780 if (screens.at(i).name == screenName)
781 {
782 screens.at(i).ChangePage(pageNumber);
783 return;
784 }
785 }
786
787 sprintf_s(msg, sizeof msg, "Displays::ChangePage could not find screen named: %s", screenName.c_str());
788 logger->Log(msg, Logger::Warn);
789}
790
791std::string Displays::TogglePage(std::string screenName)
792{
793 logger->AddToCallStack("Displays::TogglePage");
794 for (UINT i = 0; i < screens.size(); i++)
795 {
796 if (screens.at(i).name == screenName)
797 {
798 if (screens.at(i).pages.size() == 0)
799 return "";
800 screens.at(i).currentPage++;
801 if (screens.at(i).currentPage >= screens.at(i).pages.size())
802 screens.at(i).currentPage = 0;
803 screens.at(i).OnPageChange();
804 return screens.at(i).pages.at(screens.at(i).currentPage).name;
805 }
806 }
807
808 char msg[99];
809 sprintf_s(msg, sizeof msg, "Displays::ChangePage could not find screen named: %s", screenName.c_str());
810 logger->Log(msg, Logger::Warn);
811 return "";
812}
813
814std::string Displays::TogglePageReverse(std::string screenName)
815{
816 logger->AddToCallStack("Displays::TogglePageReverse");
817 for (UINT i = 0; i < screens.size(); i++)
818 {
819 if (screens.at(i).name == screenName)
820 {
821 if (screens.at(i).pages.size() == 0)
822 return "";
823 if (screens.at(i).currentPage == 0)
824 screens.at(i).currentPage = screens.at(i).pages.size() - 1;
825 else
826 screens.at(i).currentPage--;
827 screens.at(i).OnPageChange();
828 return screens.at(i).pages.at(screens.at(i).currentPage).name;
829 }
830 }
831
832 char msg[99];
833 sprintf_s(msg, sizeof msg, "Displays::ChangePage could not find screen named: %s", screenName.c_str());
834 logger->Log(msg, Logger::Warn);
835 return "";
836}
837
838Displays::Displays(Logger* prmLogger, Bus* prmBus, HMI* prmGui)
839{
840 logger = prmLogger;
841 logger->AddToCallStack("Displays::ctor");
842 bus = prmBus;
843 gui = prmGui;
844}
845
847{
848 logger->AddToCallStack("Displays::OnCreateDevice");
849
850 if (!pDevice)
852}
853
854void Displays::OnDestroyDevice(const char* reason)
855{
856 logger->AddToCallStack("Displays::OnDestroyDevice");
857 bus->streetViewConfigured = false;
859 streetNavigation.reset();
860
861 char msg[199];
862 sprintf_s(msg, sizeof msg,
863 "Displays::OnDestroyDevice reason '%s' generation %u wrapper %p D3D9 %p sprite %p",
864 reason, deviceGeneration, static_cast<void*>(pDevice),
865 pDevice ? static_cast<void*>(pDevice->GetD3DDevice()) : nullptr,
866 pDevice ? static_cast<void*>(pDevice->pSprite) : nullptr);
867 logger->Log(msg);
868
870 scissorSupported = false;
871 renderFailureLogged = false;
872
873 logger->AddToCallStack("Displays::OnDestroyDevice FONTS");
874
875 for (UINT i = 0; i < fonts.size(); i++)
876 fonts.at(i)->OnDestroyDevice();
877 fonts.clear();
878
879 logger->AddToCallStack("Displays::OnDestroyDevice DONE");
880}
881
882void Displays::RestorePage(std::string screenName)
883{
884 logger->AddToCallStack("Displays::RestorePage");
885 char msg[99];
886
887 for (UINT i = 0; i < screens.size(); i++)
888 {
889 if (screens.at(i).name == screenName)
890 {
891 screens.at(i).RestorePage();
892 return;
893 }
894 }
895
896 sprintf_s(msg, sizeof msg, "Displays::RestorePage could not find screen named: %s", screenName.c_str());
897 logger->Log(msg, Logger::Warn);
898}
#define SAFE_DELETE_ARRAY(value)
#define V(expression)
#define SAFE_DELETE(value)
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
SCRIPT_CONTROL SCRIPT_STATE const void DWORD
@ W6Manx
Definition ServerTypes.h:84
@ EVA_SUIT
Definition ServerTypes.h:69
@ C98
Definition ServerTypes.h:61
@ ControlTower
Definition ServerTypes.h:86
@ C2
Definition ServerTypes.h:66
@ C2A
Definition ServerTypes.h:81
@ T19
Definition ServerTypes.h:87
@ P13
Definition ServerTypes.h:64
@ Apartment
Definition ServerTypes.h:80
@ E10
Definition ServerTypes.h:63
@ T120
Definition ServerTypes.h:67
@ T27
Definition ServerTypes.h:82
@ E11
Definition ServerTypes.h:68
@ A4
Definition ServerTypes.h:65
@ T121
Definition ServerTypes.h:89
AlertMessageStack(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Altimeter2(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Altimeter(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Definition Altimeter.cpp:4
AttitudeIndicator2(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
AttitudeIndicator(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Definition Bus.h:20
float StaticAirPressureMb
Definition Bus.h:406
float OutsideAirTemperatureKelvin
Definition Bus.h:80
float LinearVelocityKms
Definition Bus.h:455
float TargetDistanceKm
Definition Bus.h:502
float Mach
Definition Bus.h:456
char gearShift[2]
Definition Bus.h:528
float MapScaleInnerRingKm
Definition Bus.h:490
float PressureAltitudeKm
Definition Bus.h:31
float PressureDiffMb
Definition Bus.h:405
float PayloadWeightLbs
Definition Bus.h:464
float LatitudeDeg
Definition Bus.h:312
float GroundSpeedKms
Definition Bus.h:179
float PitchAttitudeRadians
Definition Bus.h:47
float StaticAirTemperatureCelsius
Definition Bus.h:79
float DynPresFwdLbsPerSqFt
Definition Bus.h:454
float CabinPressureMb
Definition Bus.h:403
float HeadingTrackDegrees
Definition Bus.h:303
char TimeToNextFix[6]
Definition Bus.h:505
void ClearTurnByTurn()
Definition Bus.h:517
bool streetViewConfigured
Definition Bus.h:510
RiseMath::Vector3 NormalAcceleration
Definition Bus.h:45
float IndicatedAirspeedKms
Definition Bus.h:34
struct Bus::Afcs AFCS
float YawDamperCommand
Definition Bus.h:436
float HeadingTrueDegrees
Definition Bus.h:41
float FuelFlowKgh
Definition Bus.h:463
float SpeedOfSoundKms
Definition Bus.h:457
float AirframeTemperatureCelsius
Definition Bus.h:82
float PitchTrimScalar
Definition Bus.h:415
float LocalTimeMinutes
Definition Bus.h:459
float EmptyWeightLbs
Definition Bus.h:461
float SpeedometerKPH
Definition Bus.h:180
float RadioAltitudeKm
Definition Bus.h:157
float TotalAirTemperatureCelsius
Definition Bus.h:81
float WindDirectionDegrees
Definition Bus.h:306
float LocalTimeHours
Definition Bus.h:458
float GlideslopeDeviationRadians
Definition Bus.h:159
float HeadingMagneticDegrees
Definition Bus.h:42
float WindSpeedMs
Definition Bus.h:307
float VerticalSpeedKms
Definition Bus.h:451
float TargetBearingDeg
Definition Bus.h:503
float TrueAirspeedKms
Definition Bus.h:448
float FuelWeightLbs
Definition Bus.h:462
float LongitudeDeg
Definition Bus.h:312
float AngleOfAttackRadians
Definition Bus.h:175
std::vector< Command > commandStream
Definition Bus.h:442
CarRadio(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Definition CarRadio.cpp:4
CargoManagement(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts, int height)
CargoManifestList(int height)
Compass(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Definition Compass.cpp:4
std::string profileName
Definition Component.h:13
char * chrValue
Definition Component.h:19
float bias
Definition Component.h:23
float * ptrValue
Definition Component.h:18
float modulate
Definition Component.h:24
bool abs
Definition Component.h:25
Component(Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice)
Definition Component.h:33
std::vector< Condition > conditions
Definition Component.h:26
Nullable< float > max
Definition Condition.h:11
Nullable< float > min
Definition Condition.h:10
std::vector< Sprite > sprites
Definition Condition.h:13
std::vector< Text > text
Definition Condition.h:14
ContactList(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Rendering::RenderSprite * pSprite
HRESULT SetRenderState(DWORD renderStateType, int value) const
DeviceObject(Rendering::RenderDevice *prmPd3dDevice, Logger *prmLogger)
HRESULT BeginSprites() const
void OnLostDevice() const
void OnResetDevice() const
HRESULT SetScissorRect(RECT *rect) const
Rendering::RenderDevice * GetD3DDevice()
std::vector< Font * > fonts
Definition Displays.h:25
std::string TogglePageReverse(std::string screenName)
Definition Displays.cpp:814
void OnCreateDevice()
Definition Displays.cpp:846
std::vector< Screen > screens
Definition Displays.h:24
Displays(Logger *prmLogger, Bus *prmBus, HMI *prmGui)
Definition Displays.cpp:838
Bus * bus
Definition Displays.h:16
void OnResetDevice()
Definition Displays.cpp:733
unsigned int deviceGeneration
Definition Displays.h:20
bool renderFailureLogged
Definition Displays.h:21
std::string TogglePage(std::string screenName)
Definition Displays.cpp:791
void FrameMove(float fElapsed)
Definition Displays.cpp:677
Logger * logger
Definition Displays.h:15
bool UpdateKeyRepeat(const unsigned char *keys, bool shift, float elapsed)
Definition Displays.cpp:714
std::unique_ptr< TurnByTurn > streetNavigation
Definition Displays.h:26
void OnDestroyDevice(const char *reason="unspecified")
Definition Displays.cpp:854
bool scissorSupported
Definition Displays.h:22
void OnLostDevice()
Definition Displays.cpp:722
void ChangeCockpit()
Definition Displays.cpp:562
bool HandleKeyPress(short key, bool shift)
Definition Displays.cpp:703
void Render()
Definition Displays.cpp:570
DeviceObject * pDevice
Definition Displays.h:19
HMI * gui
Definition Displays.h:17
void DeviceCreation()
Definition Displays.cpp:432
void RestorePage(std::string screenName)
Definition Displays.cpp:882
void ChangePage(std::string screenName, std::string pageName)
Definition Displays.cpp:750
void ConfigureParams(rapidxml::xml_node<> *xml_node)
Definition Displays.cpp:369
void ConfigureFonts(rapidxml::xml_node<> *xml_node)
Definition Displays.cpp:414
void ConfigureScreens(rapidxml::xml_node<> *xml_node)
Definition Displays.cpp:10
int y
Definition Element.h:9
std::vector< Component > components
Definition Element.h:10
int x
Definition Element.h:9
std::string profileName
Definition Element.h:8
ElevatorTrim(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
EngineBar(int prmX, int prmY, float prmZ, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts, int prmEngineIndex)
Definition EngineBar.cpp:4
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
FMA2(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Definition FMA2.cpp:36
FMA(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Definition FMA.cpp:4
Flaps(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Definition Flaps.cpp:4
Font(Logger *pLogger, Rendering::RenderDevice *pDevice, int width, int height, std::string name, std::string prmPathAndFilename)
Definition Font.h:16
Definition gui.h:1012
void SetLocale() const
Definition gui.cpp:1817
Networking * networking
Definition gui.h:1211
bool IsAdmin
Definition gui.h:1108
HeadlightBox(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
HeadlightIcon(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
IndicatedAirSpeed2(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
IndicatedAirSpeed(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Intermedia(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Definition Intermedia.cpp:4
LandingGear(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
LandingStrut(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts, int ordinal)
LineInput(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts, std::string prmPageName)
Definition LineInput.cpp:4
void Log(const char *msg, Level level=Info, int errorCode=0)
Definition Logger.cpp:283
void AddToCallStack(const char *msg)
Definition Logger.cpp:355
@ Warn
Definition Logger.h:26
@ Fatal
Definition Logger.h:29
@ Error
Definition Logger.h:28
MovingMap(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Definition MovingMap.cpp:8
Orbit(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Definition Orbit.cpp:5
Definition Page.h:7
std::string name
Definition Page.h:9
std::vector< Element > elements
Definition Page.h:11
std::vector< Instrument * > instruments
Definition Page.h:10
RadioAltimeter(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Scanner(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Definition Scanner.cpp:5
Definition Screen.h:6
std::string name
Definition Screen.h:25
int y
Definition Screen.h:32
bool bypassVdat
Definition Screen.h:26
int width
Definition Screen.h:29
int height
Definition Screen.h:30
int x
Definition Screen.h:31
RECT rect
Definition Screen.h:33
std::vector< Page > pages
Definition Screen.h:27
UINT currentPage
Definition Screen.h:22
Screen()
Definition Screen.h:129
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
StreetView(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts, int prmWidth, int prmHeight, TurnByTurn *prmNavigation)
Definition StreetView.cpp:5
TCASOverlay(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
int flags
Definition Text.h:66
WCHAR formattedText[32]
Definition Text.h:67
RiseMath::Color color
Definition Text.h:64
bool hasVar
Definition Text.h:68
void ReleaseResources()
void CreateVB(Rendering::RenderDevice *pd3dDevice)
void Update(bool pIsGrndVehicle, float pElasedTime)
Wind(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
Definition Wind.cpp:5
s_network_objects playerships[MAX_SCAN]
Definition globals.cpp:112
Scockpit ourcockpit
Definition globals.cpp:114
constexpr uint32_t SCISSORTESTENABLE
RenderDevice * ClientRenderer()
auto ToRadian(T value)
Definition ClientMath.h:13
float DesiredAltitudeKm
Definition Bus.h:122
float DesiredRadians
Definition Bus.h:138
float TvmCurrentClosingSpeed
Definition Bus.h:153
float DesiredVsiKms
Definition Bus.h:129
float DesiredClosingSpeed
Definition Bus.h:152
std::string sValue
Definition Command.h:20
std::string name
Definition Command.h:11
char monitor[7]
float Vs2
Definition globals.h:644
short texturelib
Definition globals.h:602
float VrEmpty
Definition globals.h:644
float MaxDoorOpenOperatingKms
Definition globals.h:645
float trimTargetEmpty
Definition globals.h:662
float aprolagr
Definition globals.h:648
float VneEmpty
Definition globals.h:644
float appitagr
Definition globals.h:648
float apYawTurnCoordination
Definition globals.h:648
float VcMSL
Definition globals.h:642
SVesselDC vdat
Definition globals.h:664
float Vle
Definition globals.h:645
float pitchToAddInTurn
Definition globals.h:643
float VneMaxGross
Definition globals.h:644
float hStabAngleOfIncidenceRad
Definition globals.h:658
float VrMaxGross
Definition globals.h:644
float trimTolerance
Definition globals.h:662
float trimTargetMaxGross
Definition globals.h:662