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); }
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)); }
/// <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); } }
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); }