Esempio n. 1
0
        public GameLoop(LoopStrategy strategy)
        {
            if (strategy == null)
                throw new ArgumentNullException("strategy");

            m_strategy = strategy;
            m_loopState = new LoopState();
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 public override void Loop(Game game, LoopState state)
 {
     state.Tick();
     game.Update(state);
     game.Render(state);
 }
Esempio n. 4
0
        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();
        }
Esempio n. 5
0
 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));
 }
Esempio n. 6
0
        public void Update(LoopState state)
        {
            state.Updates();
            bufferRender.Clear();

            dot.Update(state);
        }
Esempio n. 7
0
        public void Render(LoopState state)
        {
            state.Renderings();

            dot.Render(state, bufferRender);
            dispRender.DrawImage(buffer);
        }
Esempio n. 8
0
 public void ReadInput(LoopState state)
 {
 }