1 #define DIRECTINPUT_VERSION 0x0800 24 std::vector<Devices::InterfaceKit>
ifKits;
42 void FrameMove(
double fTime,
float fElapsedTime);
43 void InitApp(HINSTANCE hInstance);
51 int WINAPI
wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine,
int)
54 #if defined(DEBUG) | defined(_DEBUG) 55 _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_CRT_DF);
62 srand(static_cast<unsigned int>(time(
nullptr)));
70 float fElapsedTime = 0.0f;
72 double fTime = Timer.GetTime();
74 float frameTime = 0.0f;
79 msg.message = WM_NULL;
80 PeekMessage(&msg,
nullptr, 0U, 0U, PM_NOREMOVE);
82 while (WM_QUIT != msg.message)
85 bGotMsg = (PeekMessage(&msg,
nullptr, 0U, 0U, PM_REMOVE) != 0);
93 TranslateMessage(&msg);
94 DispatchMessage(&msg);
100 frameTime += fElapsedTime;
101 if (frameTime > 1.0f)
103 bus.
frameRate =
static_cast<float>(frameCount) / frameTime;
115 fTime = Timer.GetTime();
116 fElapsedTime = Timer.GetElapsedTime();
134 #pragma region InterfaceKits 137 for (UINT i = 0; i <
ifKits.size(); i++)
144 #pragma region Encoders 147 for (UINT i = 0; i <
encoders.size(); i++)
154 #pragma region Analogs 157 for (UINT i = 0; i <
analogs.size(); i++)
179 for (UINT m = 0; m <
modules.size(); m++)
185 static_cast<Vmu*
>(
modules.at(m))->Initialize(bass);
192 static_cast<Fadec*
>(
modules.at(m))->Initialize(
nullptr, bass);
197 else if (
typeid(*
modules.at(m)) ==
typeid(
Ase))
201 static_cast<Ase*
>(
modules.at(m))->Initialize(bass);
208 #pragma region DirectInput 220 for (UINT i = 0; i <
joysticks.size(); i++)
228 for (UINT m = 0; m <
modules.size(); m++)
232 static_cast<Fcs*
>(
modules.at(m))->Initialize(joystick);
238 for (UINT m = 0; m <
modules.size(); m++)
242 static_cast<Fadec*
>(
modules.at(m))->Initialize(joystick,
nullptr);
265 platform177.
location.x = -57.0f / 180.0f * 19012.290420994710720528225226931f;
266 platform177.
location.y = 7.5f / 90.0f*9506.1452104973553602641126134654f;
270 D3DXMatrixRotationX(&platform177.
mBaseOrient, D3DX_PI);
271 D3DXQuaternionRotationYawPitchRoll(&platform177.
orientation, 0, 0, D3DXToRadian(-120.0f));
275 platform419.
location.x = -57.0f / 180.0f * 19012.290420994710720528225226931f - 45.0f;
276 platform419.
location.y = 7.5f / 90.0f*9506.1452104973553602641126134654f;
280 D3DXMatrixRotationX(&platform419.
mBaseOrient, D3DX_PI);
281 D3DXQuaternionRotationYawPitchRoll(&platform419.
orientation, 0, 0, -D3DX_PI*0.5f);
291 for (UINT i = 0; i <
ifKits.size(); i++)
297 for (UINT i = 0; i <
encoders.size(); i++)
303 for (UINT i = 0; i <
analogs.size(); i++)
321 #pragma region Modules 322 for (std::vector<Module*>::iterator it =
modules.begin(); it !=
modules.end(); ++it)
328 #pragma region DirectInput 329 for (UINT i = 0; i <
joysticks.size(); i++)
369 #pragma region Inputs 381 for (UINT i = 0; i <
joysticks.size(); i++)
398 #pragma region Other I/O 399 for (UINT i = 0; i <
ifKits.size(); i++)
416 #pragma region Modules (Input and Ouput to Data Bus) 417 for (UINT i = 0; i <
modules.size(); i++)
424 #pragma region Outputs 425 for (UINT i = 0; i <
analogs.size(); i++)
438 static float lastErrorTime = 60.0f;
439 lastErrorTime += fElapsedTime;
442 if (
logger.
lastError.find(
"SendEmail") == std::string::npos && lastErrorTime > 60.0f)
445 lastErrorTime = 0.0f;
455 for (UINT i = 0; i < 10; i++)
458 if (fElapsedTime > 3.0f)
461 sprintf_s(msg, 99,
"Program delay detected (%.3f)!", fElapsedTime);
465 catch (std::exception& e)
468 logger.
Log(e.what(), Logger::Level::Error);
void InitApp(HINSTANCE hInstance)
std::vector< HWND > GetWindowHandles() const
void SendEmail(std::string subject, std::string body="", int severity=0)
Systems::Virtualization virtualization
Devices::TeamSpeak teamSpeak
Devices::SpatialConfig spatialConfig
void Initialize(Logger *logger, EncoderConfig *config, Bus *prmBus)
std::vector< Devices::AnalogConfig > analogConfigs
void Render(float fElapsed)
std::vector< Vehicle > vehicles
for TCAS, GPWS, FMS
void Initialize(Logger *prmLogger, TeamSpeakConfig *prmConfig, Bus *prmBus)
Devices::TeamSpeakConfig teamSpeakConfig
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR lpCmdLine, int)
void FrameMove(float fElapsed)
void Initialize(HINSTANCE)
Adaptive Scenario Engine.
void Initialize(Logger *logger, SpatialConfig *config, Bus *prmBus)
void Initialize(Logger *, RakNetConfig *, Bus *)
void Initialize(Logger *logger, AnalogConfig *config, Bus *prmBus)
void Initialize(Logger *logger, ApcupsdConfig *config, Bus *bus)
std::vector< Devices::InterfaceKit > ifKits
void FrameMove(float fElapsed)
std::vector< Devices::Encoder > encoders
virtual void FrameMove(float fElapsedTime)=0
C++ monitoring implementation of http://www.apcupsd.org.
Devices::RakNetConfig rakNetConfig
Devices::WebcamConfig webcamConfig
Full Authority Digital Engine Control.
void Initialize(Logger *logger, Bus *prmBus, HWND hWnd)
Devices::YouTubeConfig youTubeConfig
Devices::ApcupsdConfig apcupsdConfig
void Initialize(Logger *logger, std::vector< Module *> *modules, Bus *prmBus, Viewport *viewport, WCHAR *configFile)
void FrameMove(float fElapsed, double fTime)
Abstract base class for modules By definition, instruments don't do any of the work (they don't modif...
void FrameMove(float fElapsed)
std::vector< Module * > modules
void SetWindowHandles(std::vector< HWND > prmHwnds)
Devices::XplaneConfig xplaneConfig
void FrameMove(float fElapsed)
std::vector< Devices::InterfaceKitConfig > interfaceKitConfigs
void Log(const char *msg, Level level=Info, int errorCode=0)
These have to be in this order.
void Initialize(Logger *logger, JoystickConfig *config, Bus *prmBus, LPDIRECTINPUT8 g_pDI)
std::vector< Devices::Analog > analogs
void Teardown()
clean-up memory (everything in InitApp)
std::vector< Devices::EncoderConfig > encoderConfigs
void FrameMove(double fTime)
std::vector< Devices::JoystickConfig > joystickConfigs
void Initialize(Logger *, Bus *, YouTubeConfig *)
void Initialize(Logger *logger, InterfaceKitConfig *config, Bus *prmBus)
std::vector< Devices::Bass > audioDevices
void FrameMove(double fTime, float fElapsedTime)
std::vector< Devices::BassConfig > bassConfigs
void Initialize(Logger *prmLogger, BassConfig *prmConfig, Bus *prmBus)
Devices::KeyboardConfig keyboardConfig
void Initialize(Logger *logger, KeyboardConfig *config, Bus *prmBus, LPDIRECTINPUT8 g_pDI)
void Initialize(Logger *prmLogger, WebcamConfig *prmConfig, Bus *prmBus)
D3DXQUATERNION orientation
#define DIRECTINPUT_VERSION
std::vector< Devices::Joystick > joysticks
void Initialize(Logger *logger, XplaneConfig *config, Bus *prmBus)
Devices::Keyboard keyboard