当前位置: 首页>>代码示例>>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;未经允许,请勿转载。