當前位置: 首頁>>代碼示例>>C#>>正文


C# SpriteBatch.GetScreenDimensions方法代碼示例

本文整理匯總了C#中Microsoft.Xna.Framework.Graphics.SpriteBatch.GetScreenDimensions方法的典型用法代碼示例。如果您正苦於以下問題:C# SpriteBatch.GetScreenDimensions方法的具體用法?C# SpriteBatch.GetScreenDimensions怎麽用?C# SpriteBatch.GetScreenDimensions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Microsoft.Xna.Framework.Graphics.SpriteBatch的用法示例。


在下文中一共展示了SpriteBatch.GetScreenDimensions方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Draw

 public void Draw(SpriteBatch spriteBatch)
 {
     AABB box = DialogHelpers.CalculateBox(this).Move(spriteBatch.GetScreenDimensions() / 2);
     spriteBatch.Draw(box, Color.WhiteSmoke, 1, Color.Black);
     spriteBatch.DrawString(_font, _msg, box.TopLeft + new Vector2(10, 10), Color.Black);
     _btnYes.Draw(spriteBatch, box.TopLeft + _btnYesOffset);
     _btnNo.Draw(spriteBatch, box.TopLeft + _btnNoOffset);
 }
開發者ID:Jaywd,項目名稱:binary.fail.project.haumea,代碼行數:8,代碼來源:Confirm.cs

示例2: Draw

        public void Draw(SpriteBatch spriteBatch)
        {
            AABB box = DialogHelpers.CalculateBox(this).Move(spriteBatch.GetScreenDimensions() / 2);

            string  label      = "Input: ";
            Vector2 labelPos   = box.TopLeft + new Vector2(10, 40);
            float   labelWidth = _font.MeasureString(label).X;

            spriteBatch.Draw(box, Color.WhiteSmoke, 1, Color.Black);
            spriteBatch.DrawString(_font, label, labelPos, Color.Black);

            _textField.Draw(spriteBatch, new Vector2(labelPos.X + labelWidth + 5, labelPos.Y));
        }
開發者ID:Jaywd,項目名稱:binary.fail.project.haumea,代碼行數:13,代碼來源:Prompt.cs

示例3: LoadContent

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        public void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(_gdm.GraphicsDevice);
            RenderState renderState = new RenderState(_spriteBatch.GetScreenDimensions());
            _renderer = new Renderer(_gdm.GraphicsDevice, renderState);

            _mouseCursorTexture = _content.Load<Texture2D>("cursor");
            _logFont            = _content.Load<SpriteFont>("LogFont");

            LoadFile("../../gamedata.haumea");

            foreach (IView view in _views)
            {
                view.LoadContent(_content);
            }
        }
開發者ID:Jaywd,項目名稱:binary.fail.project.haumea,代碼行數:21,代碼來源:Engine.cs

示例4: Draw

        public void Draw(SpriteBatch spriteBatch, Renderer renderer)
        {
            Vector2 portOffset = renderer.RenderState.Camera.Offset;

            Vector2 screen = spriteBatch.GetScreenDimensions();
            const int size = 200;
            float xyratio = screen.X / screen.Y;
            Vector2 dim = new Vector2(size * xyratio, size);

            if (!_initialized && _wait-- == 0) CreateMapTexture(renderer);

            if (_initialized)
            {
                const int offset = 120;
                Rectangle target = new Rectangle((screen - dim).ToPoint(), dim.ToPoint());
                Rectangle source = new Rectangle((int)(offset * xyratio), offset,
                    (int)(screen.X - offset * xyratio), (int)screen.Y - offset);
                spriteBatch.Draw(_renderTarget, target, source, Color.White);
            }

            Debug.WriteToScreen("wait", _wait);
        }
開發者ID:Jaywd,項目名稱:binary.fail.project.haumea,代碼行數:22,代碼來源:MiniMap.cs


注:本文中的Microsoft.Xna.Framework.Graphics.SpriteBatch.GetScreenDimensions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。