Exemplo n.º 1
0
        public override async Task Execute()
        {

            SpriteFont font = await Content.LoadAsync<SpriteFont>("Segoe_UI_10_Regular");
            FontManager.DefaultFont = Engine.Instance.Renderer.CreateFont(font);

            XenkoRenderer.GraphicsContext = Game.GraphicsContext;
            uiRoot = new BasicUI();
            debug = new DebugViewModel(uiRoot);
            uiRoot.DataContext = new BasicUIViewModel();
            
            FontManager.Instance.LoadFonts(Content);
            SoundManager.Instance.LoadSounds(Content);
            ImageManager.Instance.LoadImages(Content);
            EffectManager.Instance.LoadEffects(EffectSystem);
            
            var scene = SceneSystem.SceneInstance.Scene;
            var compositor = ((SceneGraphicsCompositorLayers)scene.Settings.GraphicsCompositor);
            compositor.Master.Renderers.Add(new SceneDelegateRenderer(Render));

            while (Game.IsRunning)
            {
                await Script.NextFrame();
                debug.Update();
                uiRoot.UpdateInput(Game.UpdateTime.Elapsed.TotalMilliseconds);
                uiRoot.UpdateLayout(Game.UpdateTime.Elapsed.TotalMilliseconds);
            }            
        }
Exemplo n.º 2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            _stopwatch.Restart();
            World.Update(gameTime.ElapsedGameTime.TotalMilliseconds);

            _basicUI.UpdateInput(gameTime.ElapsedGameTime.TotalMilliseconds);

            //_viewModel.Update(gameTime.ElapsedGameTime.TotalMilliseconds);
            //_basicUI.UpdateLayout(gameTime.ElapsedGameTime.TotalMilliseconds);

            _updateTime = _stopwatch.Elapsed.TotalMilliseconds;

            base.Update(gameTime);
        }