Ejemplo n.º 1
0
        public static void MyConfig()
        {
            WindowConfig();
            myWindow.SetActive(false);
            Thread.CurrentThread.Priority = ThreadPriority.Highest;
            renderingThread.Start();

            //Screen myScreen = Screen.PrimaryScreen;

            while (myWindow.IsOpen)
            {
                if (frameClock.ElapsedTime.AsMicroseconds() >= frameTimeMicro)
                {
                    myWindow.DispatchEvents();
                    KeyboardEventHandler.KeyStateActions(myWindow);
                    MouseEventHandler.MouseButtonStateActions(myWindow);
                    eventsCompleted.Set();                     // Disable lock on RenderingThread operations.
                    frameClock.Restart();

                    if (FrameratePerSecond <= 60)                       // Considerably reduces CPU usage, but doesn't work well with high framerates (>60).
                    {
                        Thread.Sleep(1);
                    }
                }
            }

            renderingThread.Abort();
        }