Exemplo n.º 1
0
        public void Run()
        {
            Rect dstRect   = new Rect();
            long startTime = Java.Lang.System.NanoTime();

            while (running)
            {
                if (!holder.GetSurface().IsValid())
                {
                    continue;
                }


                float deltaTime = (Java.Lang.System.NanoTime() - startTime) / 10000000.000f;
                startTime = Java.Lang.System.NanoTime();

                if (deltaTime > 3.15)
                {
                    deltaTime = (float)3.15;
                }


                game.getCurrentScreen().update(deltaTime);
                game.getCurrentScreen().paint(deltaTime);



                Canvas canvas = holder.LockCanvas();
                canvas.GetClipBounds(dstRect);
                canvas.DrawBitmap(framebuffer, null, dstRect, null);
                holder.UnlockCanvasAndPost(canvas);
            }
        }