Exemplo n.º 1
0
        public void Run()
        {
            timer     = new FpsTimer();
            timer.Fps = 60;
            DoGC();
            while (SDLFrame.PollEvent() == YanesdkResult.NoError)
            {
                timer.WaitFrame();
                audioDevice.Update();
                inputDevice.Update();
                bool gc = Tick();
                if (currentState == State.Exit)
                {
                    break;
                }
                if (!timer.ToBeSkip)
                {
                    Draw();
                }
                if (gc)
                {
                    DoGC();
                }
            }

            settings.NumUnlockedStages = numUnlockedStages;
            settings.Save("settings.cfg");

            if (log != null)
            {
                log.Close();
            }

            SDLFrame.Quit();
        }
Exemplo n.º 2
0
        public void Run()
        {
            timer     = new FpsTimer();
            timer.Fps = 30;
            GameManager manager = new GameManager(audio, startLevel);

            manager.LoadScoreDataFromFile("score.dat");
            while (SDLFrame.PollEvent() == YanesdkResult.NoError)
            {
                input.Update();
                manager.Update(input);
                if (manager.Exiting)
                {
                    break;
                }
                if (!timer.ToBeSkip)
                {
                    graphics.Begin();
                    manager.Draw(graphics);
                    graphics.End();
                }
                timer.WaitFrame();
            }
            manager.SaveScoreDataToFile("score.dat");
        }