Пример #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();
        }
Пример #2
0
        /// <summary>
        /// Function called when a character/text is entered.
        /// </summary>
        public static void OnTextEntered(object sender, TextEventArgs e)
        {
            RenderWindow window = (RenderWindow)sender;

            KeyboardEventHandler.TextEnteredActions(window, e);
        }
Пример #3
0
        /// <summary>
        /// Function called when a key is released.
        /// </summary>
        public static void OnKeyReleased(object sender, KeyEventArgs e)
        {
            RenderWindow window = (RenderWindow)sender;

            KeyboardEventHandler.KeyReleasedActions(window, e);
        }