예제 #1
0
        protected override void LoadContent()
        {
            spriteBatch    = new SpriteBatch(GraphicsDevice);
            spriteBatchGui = new SpriteBatch(GraphicsDevice);
            spriteBatchAdd = new SpriteBatch(GraphicsDevice);

            Tex.Init();
            Font.Init();
            defaultFont = Font.andy30;

            MyUiManager.Init();
        }
예제 #2
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);
        }
예제 #3
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);
        }