Пример #1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            int dt = gameTime.ElapsedGameTime.Milliseconds;

            spriteBatchAdd.Begin();
            spriteBatchGui.Begin();
            spriteBatch.Begin();
            MyUiManager.Get().Draw(dt);
            spriteBatch.End();
            spriteBatchGui.End();
            spriteBatchAdd.End();

            base.Draw(gameTime);
        }
Пример #2
0
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                MyUiManager.Get().PressBack();
            }

            int dt = gameTime.ElapsedGameTime.Milliseconds;

            TouchCollection tc = TouchPanel.GetState();

            foreach (TouchLocation tl in tc)
            {
                ToTouchInfo(tl, ref touchInfo);
                App.Get().defaultUIViewport.ScreenToViewport(touchInfo.Position, ref touchInfo.Position);
                MyUiManager.Get().Consume(touchInfo);
            }

            MyUiManager.Get().Update(dt);

            base.Update(gameTime);
        }