Privacy
An open-source, flexible 3D physical simulation framework
GraphicsTimer.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2013 DFKI GmbH Robotics Innovation Center
3  *
4  * This file is part of the MARS simulation framework.
5  *
6  * MARS is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation, either version 3
9  * of the License, or (at your option) any later version.
10  *
11  * MARS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with MARS. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #include "GraphicsTimer.h"
22 #include <mars/utils/misc.h>
23 
24 namespace mars {
25  namespace viz {
26 
28 
30  : graphics(graphics_) {
31  graphicsTimer = new QTimer();
32  connect(graphicsTimer, SIGNAL(timeout()), this, SLOT(timerEvent()));
33  connect(this, SIGNAL(internalRun()), this, SLOT(runOnceInternal()),
34  Qt::QueuedConnection);
35  }
36 
38  graphicsTimer->start(10);
39  }
40 
42  graphicsTimer->stop();
43  }
44 
45 
47  runFinished=false;
48  emit internalRun();
49  while(!runFinished){
51  }
52  }
53 
55  timerEvent();
56  runFinished=true;
57  }
58 
60  graphics->draw();
61  }
62 
63  } // end of namespace viz
64 } // end of namespace mars
mars::interfaces::GraphicsManagerInterface * graphics
Definition: GraphicsTimer.h:54
void msleep(unsigned int milliseconds)
sleeps for at least the specified time.
Definition: misc.h:96
Copyright 2012, DFKI GmbH Robotics Innovation Center.
GraphicsTimer(mars::interfaces::GraphicsManagerInterface *graphics_)