Пример #1
0
        static void Main(string[] args)
        {
            i  = new InputManager();
            d  = new display();
            gb = new gameBoard(d);
            pd = new paddle(2, d, 1);
            b  = new ball(d, 2, pd);

            //c = new Controllers.PlayerController();
            //c = new Controllers.PerfectAI();
            c = new Controllers.PerfectAiHybrid();

            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            int counter = 0;

            while (!i.IsKeyFalling(OpenTK.Input.Key.Escape))
            {
                stopwatch.Start();

                i.Update();
                d.draw(true);
                doGameUpdate();

                //System.Threading.Thread.Sleep(5);

                stopwatch.Stop();

                counter++;
                fps = (int)(1.0 / ((double)stopwatch.ElapsedMilliseconds / (double)counter) * 1000.0);

                if (counter > 200)
                {
                    stopwatch.Reset();
                    counter = 0;
                }
            }
        }