本文整理汇总了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);
}
示例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));
}
示例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);
}
}
示例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);
}