internal override void Run()
        {
            Debug.Assert(InitCallback != null, $"{nameof(InitCallback)} is null");
            Debug.Assert(RunCallback != null, $"{nameof(RunCallback)} is null");

            // Initialize the init callback
            InitCallback();

            var runCallback = new SDLMessageLoop.RenderCallback(RunCallback);

            // Run the rendering loop
            try
            {
                SDLMessageLoop.Run(window, () =>
                {
                    if (Exiting)
                    {
                        Destroy();
                        return;
                    }

                    runCallback();
                });
            }
            finally
            {
                ExitCallback?.Invoke();
            }
        }
Esempio n. 2
0
        internal override void Run()
        {
            Debug.Assert(InitCallback != null, $"{nameof(InitCallback)} is null");
            Debug.Assert(RunCallback != null, $"{nameof(RunCallback)} is null");

            // Initialize the init callback
            InitCallback();

            var context = (GameContextSDL)GameContext;

            if (context.IsUserManagingRun)
            {
                context.RunCallback  = RunCallback;
                context.ExitCallback = ExitCallback;
            }
            else
            {
                var runCallback = new SDLMessageLoop.RenderCallback(RunCallback);
                // Run the rendering loop
                try
                {
                    SDLMessageLoop.Run(window, () =>
                    {
                        if (Exiting)
                        {
                            Destroy();
                            return;
                        }

                        runCallback();
                    });
                }
                finally
                {
                    ExitCallback?.Invoke();
                }
            }
        }