DrawLoadingScreen() static private méthode

Draws on OpenGL canvas the route/train loading screen
static private DrawLoadingScreen ( ) : void
Résultat void
Exemple #1
0
        public static void LoadingScreenLoop()
        {
            GL.Disable(EnableCap.DepthTest);
            GL.MatrixMode(MatrixMode.Projection);
            GL.PushMatrix();
            GL.LoadIdentity();
            GL.Ortho(0.0, (double)Renderer.ScreenWidth, (double)Renderer.ScreenHeight, 0.0, -1.0, 1.0);
            GL.Viewport(0, 0, Renderer.ScreenWidth, Renderer.ScreenHeight);

            while (!Loading.Complete && !Loading.Cancel)
            {
                CPreciseTimer.GetElapsedTime();
                Program.currentGameWindow.ProcessEvents();
                if (Program.currentGameWindow.IsExiting)
                {
                    Loading.Cancel = true;
                }

                Renderer.DrawLoadingScreen();
                Program.currentGameWindow.SwapBuffers();

                if (Loading.JobAvailable)
                {
                    while (jobs.Count > 0)
                    {
                        lock (jobLock)
                        {
                            var currentJob = jobs.Dequeue();
                            var locker     = locks.Dequeue();
                            currentJob();
                            lock (locker)
                            {
                                Monitor.Pulse(locker);
                            }
                        }
                    }
                    Loading.JobAvailable = false;
                }
                double time = CPreciseTimer.GetElapsedTime();
                double wait = 1000.0 / 60.0 - time * 1000 - 50;
                if (wait > 0)
                {
                    Thread.Sleep((int)(wait));
                }
            }
            if (!Loading.Cancel)
            {
                GL.PopMatrix();
                GL.MatrixMode(MatrixMode.Projection);
            }
            else
            {
                Program.currentGameWindow.Exit();
            }
        }