00001 // SimulatorThread.h: interface for the SimulatorThread class. 00002 // 00004 00005 #ifndef SIMULATORTHREAD_H 00006 #define SIMULATORTHREAD_H 00007 00008 #include "wxIncludes.h" 00009 00010 class ThyrixMainFrame; 00011 class World; 00012 00013 class SimulatorThread : public wxThread { 00014 public: 00015 SimulatorThread(ThyrixMainFrame *iniFrame); 00016 virtual ~SimulatorThread(); 00017 00018 // thread execution starts here 00019 virtual void* Entry(); 00020 00023 virtual void OnExit(); 00024 00025 void setTimeFactor(float newFactor); 00026 00027 /* Compute the interval between frames, in ms, given a desired number of frames 00028 per second. **/ 00029 void setFramesPerSecond(int fps); 00030 00031 void setPause(); 00032 00035 void step(); 00036 00037 World* world; 00038 00039 private: 00041 void sleepIfAhead(); 00042 00044 float timeFactor; 00045 00047 unsigned frameInterval; 00048 00050 bool paused; 00051 00054 float expectedTime; 00055 00058 wxStopWatch simulationTimer; 00059 00061 ThyrixMainFrame *frame; 00062 00063 00064 }; 00065 00066 #endif //SIMULATORTHREAD_H
Thyrix homepage Users' guide
(C) Arxia 2004-2005