コード例 #1
0
        protected override void Initialize()
        {
            base.Initialize();

            MInput.Initialize();
            Tracker.Initialize();
            Pooler   = new Monocle.Pooler();
            Commands = new Commands();
        }
コード例 #2
0
        protected override void Update(GameTime gameTime)
        {
            DeltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds * TimeRate;

            //Update input
            MInput.Update();

            if (ExitOnEscapeKeypress && MInput.Keyboard.Pressed(Microsoft.Xna.Framework.Input.Keys.Escape))
            {
                                #if __IOS__
                                #else
                Exit();
                                #endif
                return;
            }

            //Update current scene
            if (FreezeTimer > 0)
            {
                FreezeTimer = Math.Max(FreezeTimer - DeltaTime, 0);
            }
            else if (scene != null)
            {
                scene.BeforeUpdate();
                scene.Update();
                scene.AfterUpdate();
            }

            //Debug Console
            if (Commands.Open)
            {
                Commands.UpdateOpen();
            }
            else if (Commands.Enabled)
            {
                Commands.UpdateClosed();
            }

            //Changing scenes
            if (scene != nextScene)
            {
                if (scene != null)
                {
                    scene.End();
                }
                scene = nextScene;
                OnSceneTransition();
                if (scene != null)
                {
                    scene.Begin();
                }
            }

            base.Update(gameTime);
        }
コード例 #3
0
 protected override void OnExiting(object sender, EventArgs args)
 {
     base.OnExiting(sender, args);
     MInput.Shutdown();
 }