Example #1
0
        public static void Update(float systemTime)
        {
            Simulation pSim = Simulation.PrivGetInstance();

            Debug.Assert(pSim != null);

            // update input
            pSim.PrivProcessInput();

            // Time update.
            //      Get the time that has passed.
            //      Feels backwards, but its not, need to see how much time has passed
            pSim.stopWatch_toc = systemTime - pSim.stopWatch_tic;
            pSim.stopWatch_tic = systemTime;

            if (pSim.PrivGetState() == State.FixedStep)
            {
                pSim.timeStep = SIM_SINGLE_TIME_STEP;
            }
            else if (pSim.PrivGetState() == State.Realtime)
            {
                pSim.timeStep = pSim.stopWatch_toc;
            }
            else if (pSim.PrivGetState() == State.SingleStep)
            {
                pSim.timeStep = SIM_SINGLE_TIME_STEP;
                pSim.PrivSetState(State.Pause);
            }
            else //  pSim->getState() == SimulationEnum::Pause
            {
                pSim.timeStep = 0.0f;
            }

            pSim.totalWatch += pSim.timeStep;
        }
Example #2
0
        public static State GetState()
        {
            Simulation pSim = Simulation.PrivGetInstance();

            Debug.Assert(pSim != null);

            return(pSim.PrivGetState());
        }