コード例 #1
0
        public void Shutdown()
        {
            lock (lockObj)
            {
                NextScene = null;

                CurrentScene?.Close();
                CurrentScene = null;
            }
        }
コード例 #2
0
        public void Update(GameTime gameTime)
        {
            Performance.Push("Game loop");

            InputManager.UpdateInput(gameTime);

            lock (lockObj)
            {
                if (NextScene != null)
                {
                    if (CurrentScene != null)
                    {
                        CurrentScene.Close();
                    }

                    CurrentScene = NextScene;
                    if (CurrentScene != null)
                    {
                        CurrentScene.Init(this);
                    }

                    NextScene = null;
                }

                if (CurrentScene != null)
                {
                    if (CurrentScene.MouseCursor != null)
                    {
                        CurrentScene.MouseCursor.Position = InputManager.MousePosition;
                    }

                    CurrentScene.Update(gameTime);
                }
            }

            Performance.Pop();
        }