示例#1
0
 /// <summary>
 /// Processes operating system events until the NativeWindow becomes idle.
 /// </summary>
 /// <param name="retainEvents">If true, the state of underlying system event propagation will be preserved, otherwise event propagation will be enabled if it has not been already.</param>
 protected void ProcessEvents(bool retainEvents)
 {
     EnsureUndisposed();
     if (!retainEvents && !events)
     {
         Events = true;
     }
     implementation.ProcessEvents();
 }
示例#2
0
 /// <summary>
 /// Processes operating system events until the NativeWindow becomes idle.
 /// </summary>
 /// <param name="retainEvents">If true, the state of underlying system event propagation will be preserved, otherwise event propagation will be enabled if it has not been already.</param>
 protected void ProcessEvents(bool retainEvents)
 {
     EnsureUndisposed();
     if (this.thread_id != System.Threading.Thread.CurrentThread.ManagedThreadId)
     {
         throw new InvalidOperationException("ProcessEvents must be called on the same thread that created the window.");
     }
     if (!retainEvents && !events)
     {
         Events = true;
     }
     implementation.ProcessEvents();
 }
示例#3
0
文件: Game.cs 项目: johang88/triton
        private void RenderLoop()
        {
            var graphicsMode = new GraphicsMode(new ColorFormat(32), 24, 0, 0);
            Window = new NativeWindow(RequestedWidth, RequestedHeight, Name, GameWindowFlags.Default, graphicsMode, DisplayDevice.Default);
            Window.Visible = true;
            Window.CursorVisible = false;

            using (GraphicsBackend = new Triton.Graphics.Backend(CoreResources, Window.Width, Window.Height, Window.WindowInfo))
            {
                Triton.Graphics.Resources.ResourceLoaders.Init(CoreResources, GraphicsBackend, FileSystem);
                Triton.Graphics.Resources.ResourceLoaders.Init(GameResources, GraphicsBackend, FileSystem);

                RendererReady.Set();

                while (Running)
                {
                    Window.ProcessEvents();

                    if (!Window.Exists)
                        break;

                    CoreResources.TickResourceLoading(100);
                    GameResources.TickResourceLoading(10);

                    if (!GraphicsBackend.Process())
                        break;

                    Thread.Sleep(1);
                }

                Running = false;
            }
        }