public GameLoop(LoopStrategy strategy) { if (strategy == null) throw new ArgumentNullException("strategy"); m_strategy = strategy; m_loopState = new LoopState(); }
public override void Loop(Game game, LoopState state) { state.Tick(); accumulatedTime += state.NanoSeconds; updateCount = 0; while (accumulatedTime >= frameRate && updateCount < maxCount) { game.Update(state); updateCount++; accumulatedTime -= frameRate; } state.Interpolation = accumulatedTime/frameRate; game.Render(state); //var sleepTime = (frameRate - state.MilliSeconds); //if(sleepTime > 0) // Thread.Sleep((int)sleepTime); }
public override void Loop(Game game, LoopState state) { state.Tick(); game.Update(state); game.Render(state); }
public void Update(LoopState state) { lastX = x; lastY = y; x += xVelocity*/*(1.0/60.0);//*/ state.Seconds; y += yVelocity*/*(1.0/60.0);//*/ state.Seconds; //Debug.WriteLine("x,y - {0},{1}", x , y); HandelCollition(); }
public void Render(LoopState state, AsciiGraphics g) { ax = /*x;//*/ (x - lastX) * state.Interpolation + lastX; ay = /*y;//*/ (y - lastY) * state.Interpolation + lastY; Debug.WriteLine("ay,ay - {0},{1}", ax, ay); g.DrawPoint(new AsciiPen('O', AsciiColors.Red), new Point((uint)ax, (uint)ay)); }
public void Update(LoopState state) { state.Updates(); bufferRender.Clear(); dot.Update(state); }
public void Render(LoopState state) { state.Renderings(); dot.Render(state, bufferRender); dispRender.DrawImage(buffer); }
public void ReadInput(LoopState state) { }