]> git.mxchange.org Git - flightgear.git/blob - JSBsim/FGMain.cpp
6f1c6de9367af053daf2b9f864f21ee9758a962f
[flightgear.git] / JSBsim / FGMain.cpp
1 #define FDM_MAIN
2 #include "FGFDMExec.h"
3 #undef FDM_MAIN
4
5 #include <iostream.h>
6 #include <time.h>
7
8 void main(int argc, char** argv)
9 {
10   struct timespec short_wait = {0,100000000};
11   struct timespec no_wait    = {0,100000000};
12
13   if (argc != 3) {
14     cout << endl
15          << "  You must enter the name of a registered aircraft and reset point:"
16          << endl << endl << "  FDM <aircraft name> <reset file>" << endl;
17     exit(0);
18   }
19
20   FDMExec = new FGFDMExec();
21
22   Aircraft->LoadAircraft(argv[1]);
23   State->Reset(argv[2]);
24
25   while (State->Setsim_time(State->Getsim_time() + 0.1) <= 25.0)
26   {
27     FDMExec->Run();
28     nanosleep(&short_wait,&no_wait);
29   }
30
31   delete FDMExec;
32 }