public override void Draw(SpriteBatchUI spriteBatch, Vector2Int position, double frameMS) { var caratPosition = new Vector2Int(position.x, position.y); if (IsEditable) { if (_renderedText.Width + _renderedCarat.Width <= Width) { _renderedText.Draw(spriteBatch, position, Utility.GetHueVector(Hue)); caratPosition.x += _renderedText.Width; } else { int textOffset = _renderedText.Width - (Width - _renderedCarat.Width); _renderedText.Draw(spriteBatch, new RectInt(position.x, position.y, _renderedText.Width - textOffset, _renderedText.Height), textOffset, 0, Utility.GetHueVector(Hue)); caratPosition.x += (Width - _renderedCarat.Width); } } else { caratPosition.x = 0; _renderedText.Draw(spriteBatch, new RectInt(position.x, position.y, Width, Height), 0, 0, Utility.GetHueVector(Hue)); } if (_caratBlinkOn) { _renderedCarat.Draw(spriteBatch, caratPosition, Utility.GetHueVector(Hue)); } base.Draw(spriteBatch, position, frameMS); }
public override void Draw(SpriteBatchUI spriteBatch, Point position) { Point caratPosition = new Point(position.X, position.Y); if (IsEditable) { if (m_RenderedText.Width + m_Carat.Width <= Width) { m_RenderedText.Draw(spriteBatch, position, Utility.GetHueVector(Hue)); caratPosition.X += m_RenderedText.Width; } else { int textOffset = m_RenderedText.Width - (Width - m_Carat.Width); m_RenderedText.Draw(spriteBatch, new Rectangle(position.X, position.Y, m_RenderedText.Width - textOffset, m_RenderedText.Height), textOffset, 0, Utility.GetHueVector(Hue)); caratPosition.X += (Width - m_Carat.Width); } } else { caratPosition.X = 0; m_RenderedText.Draw(spriteBatch, new Rectangle(position.X, position.Y, Width, Height), 0, 0, Utility.GetHueVector(Hue)); } if (m_CaratBlinkOn) { m_Carat.Draw(spriteBatch, caratPosition, Utility.GetHueVector(Hue)); } base.Draw(spriteBatch, position); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { ResetHueVector(); ShaderHueTranslator.GetHueVector ( ref HueVector, 0, false, 1.0f - _alpha / 255f, true ); UOTexture texture = GumpsLoader.Instance.GetTexture(Graphic); if (texture != null) { if (ProfileManager.CurrentProfile != null && ProfileManager.CurrentProfile.BuffBarTime) { batcher.Draw2D(texture, x, y, ref HueVector); return(_gText.Draw(batcher, x - 3, y + texture.Height / 2 - 3, HueVector.Z)); } return(batcher.Draw2D(texture, x, y, ref HueVector)); } return(false); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { Vector3 hueVector = ShaderHueTranslator.GetHueVector ( 0, false, _alpha / 255f, true ); var texture = GumpsLoader.Instance.GetGumpTexture(Graphic, out var bounds); if (texture != null) { batcher.Draw ( texture, new Vector2(x, y), bounds, hueVector ); if (ProfileManager.CurrentProfile != null && ProfileManager.CurrentProfile.BuffBarTime) { _gText.Draw(batcher, x - 3, y + bounds.Height / 2 - 3, hueVector.Z); } } return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { if (!string.IsNullOrWhiteSpace(_label.Text) && MouseIsOver) { ResetHueVector(); batcher.Draw2D ( SolidColorTextureCache.GetTexture(Color.Gray), x + 2, y + 5, Width - 4, Height - 10, ref HueVector ); } base.Draw(batcher, x, y); if (_entry.Items != null && _entry.Items.Count != 0) { _moreMenuLabel.Draw(batcher, x + Width - _moreMenuLabel.Width, y + (Height >> 1) - (_moreMenuLabel.Height >> 1) - 1); } return(true); }
public void Draw(SpriteBatchUI spriteBatch, int x, int y) { // determine if properties need to be updated. if (m_Entity != null && m_PropertyListHash != m_Entity.PropertyList.Hash) { m_PropertyListHash = m_Entity.PropertyList.Hash; Caption = m_Entity.PropertyList.Properties; } // update text if necessary. if (m_RenderedText == null) { m_RenderedText = new RenderedText("<center>" + Caption, 300, true); } else if (m_RenderedText.Text != "<center>" + Caption) { m_RenderedText = null; m_RenderedText = new RenderedText("<center>" + Caption, 300, true); } // draw checkered trans underneath. spriteBatch.Draw2DTiled(CheckerTrans.CheckeredTransTexture, new Rectangle(x - 4, y - 4, m_RenderedText.Width + 8, m_RenderedText.Height + 8), Vector3.Zero); // draw tooltip contents m_RenderedText.Draw(spriteBatch, new Point(x, y)); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { if (IsDisposed || !SetName()) { return(false); } float scale = Engine.SceneManager.GetScene <GameScene>().Scale; int gx = Engine.Profile.Current.GameWindowPosition.X; int gy = Engine.Profile.Current.GameWindowPosition.Y; int w = Engine.Profile.Current.GameWindowSize.X; int h = Engine.Profile.Current.GameWindowSize.Y; if (Entity is Mobile m) { GetAnimationDimensions(m, 0, out int centerX, out int centerY, out int width, out int height); x = (int)((Entity.RealScreenPosition.X + m.Offset.X + 22) / scale); y = (int)((Entity.RealScreenPosition.Y + (m.Offset.Y - m.Offset.Z) - (height + centerY + 8)) / scale); } else if (Entity.Texture != null) { x = (int)((Entity.RealScreenPosition.X + 22) / scale); y = (int)((Entity.RealScreenPosition.Y - (Entity.Texture.Height >> 1)) / scale); } else { x = (int)((Entity.RealScreenPosition.X + 22) / scale); y = (int)((Entity.RealScreenPosition.Y + 22) / scale); } x -= Width >> 1; y -= Height >> 1; x += gx + 6; y += gy; X = x; Y = y; if (x < gx || x + Width > gx + w) { return(false); } if (y < gy || y + Height > gy + h) { return(false); } Vector3 zero = Vector3.Zero; batcher.DrawRectangle(Textures.GetTexture(Color.Gray), x - 1, y - 1, Width + 1, Height + 1, ref zero); base.Draw(batcher, x, y); return(_renderedText.Draw(batcher, x + 2, y + 2, Width, Height, 0, 0)); }
public override bool Draw(SpriteBatchUI spriteBatch, Vector3 position, Vector3?hue = null) { _labelName.Draw(spriteBatch, position + new Vector3(74, 10, 0)); _labelPing.Draw(spriteBatch, position + new Vector3(250, 10, 0)); _labelPacketLoss.Draw(spriteBatch, position + new Vector3(310, 10, 0)); return(base.Draw(spriteBatch, position, hue)); }
public override void Draw(SpriteBatchUI spriteBatch, Point position, double frameMS) { m_RenderedText.Draw(spriteBatch, new Rectangle(position.X, position.Y, Width, Height), 0, 0); if (IsEditable) { m_RenderedCarat.Text = $"{LeadingHtmlTag}|"; m_RenderedText.Draw(spriteBatch, position); if (m_CaratBlinkOn) { Point caratPosition = m_RenderedText.Document.GetCaratPositionByIndex(m_CaratAt); caratPosition.X += position.X; caratPosition.Y += position.Y; m_RenderedCarat.Draw(spriteBatch, caratPosition); } } base.Draw(spriteBatch, position, frameMS); }
public override void Draw(SpriteBatchUI spriteBatch, Vector2Int position, double frameMS) { _renderedText.Draw(spriteBatch, new RectInt(position.x, position.y, Width, Height), 0, 0); if (IsEditable) { _renderedCarat.Text = $"{LeadingHtmlTag}|"; _renderedText.Draw(spriteBatch, position); if (_caratBlinkOn) { var caratPosition = _renderedText.Document.GetCaratPositionByIndex(_caratAt); caratPosition.X += position.x; caratPosition.Y += position.y; _renderedCarat.Draw(spriteBatch, caratPosition); } } base.Draw(spriteBatch, position, frameMS); }
public override void Draw(SpriteBatchUI spriteBatch, Vector2Int position, double frameMS) { base.Draw(spriteBatch, position, frameMS); _renderedText.MouseOverRegionID = _mouseOverHREF; _renderedText.IsMouseDown = _isMouseDown; _renderedText.Draw(spriteBatch, new RectInt(position.x + (HasBackground ? 4 : 0), position.y + (HasBackground ? 4 : 0), Width - (HasBackground ? 8 : 0), Height - (HasBackground ? 8 : 0)), ScrollX, ScrollY); }
public override void Draw(SpriteBatchUI spriteBatch) { m_Texture.Draw(spriteBatch, Position); if (m_caratBlinkOn) { m_Carat.Draw(spriteBatch, new Point(X + m_Texture.Width, Y)); } base.Draw(spriteBatch); }
protected override void OnDraw(double frameMS) { _sceneManager.CurrentScene.Draw(_sb3D, _sbUI); _sbUI.GraphicsDevice.Clear(Color.Transparent); _sbUI.Begin(); _uiManager.Draw(_sbUI); _infoText.Text = $"FPS: {CurrentFPS}\nObjects: {_sceneManager.CurrentScene.RenderedObjectsCount}\nCalls: {_sb3D.Calls}\nMerged: {_sb3D.Merged}\nPos: {(World.Player == null ? "" : World.Player.Position.ToString())}\nSelected: {(_sceneManager.CurrentScene is GameScene gameScene && gameScene.SelectedObject != null ? gameScene.SelectedObject.ToString() : string.Empty)}"; _infoText.Draw(_sbUI, new Vector3(Window.ClientBounds.Width - 150, 20, 0)); _sbUI.End(); }
public override void Draw(SpriteBatchUI spriteBatch, Point position, double frameMS) { base.Draw(spriteBatch, position, frameMS); m_RenderedText.MouseOverRegionID = m_MouseOverHREF; m_RenderedText.IsMouseDown = m_IsMouseDown; m_RenderedText.Draw(spriteBatch, new Rectangle(position.X + (HasBackground ? 4 : 0), position.Y + (HasBackground ? 4 : 0), Width - (HasBackground ? 8 : 0), Height - (HasBackground ? 8 : 0)), ScrollX, ScrollY); }
public override void Draw(SpriteBatchUI spriteBatch, Vector2Int position, double frameMS) { base.Draw(spriteBatch, position, frameMS); if (Caption != string.Empty) { var yoffset = IsMouseDownOnThis ? 2 : 1; _caption.Draw(spriteBatch, new Vector2Int( position.x + (Width - _caption.Width) / 2, position.y + yoffset + (Height - _caption.Height) / 2)); } }
public override void Draw(SpriteBatchUI spriteBatch, Point position, double frameMS) { base.Draw(spriteBatch, position, frameMS); if (Caption != string.Empty) { int yoffset = IsMouseDownOnThis ? 2 : 1; m_Caption.Draw(spriteBatch, new Point( position.X + (Width - m_Caption.Width) / 2, position.Y + yoffset + (Height - m_Caption.Height) / 2)); } }
public override bool Draw(Batcher2D batcher, int x, int y) { if (IsDisposed) { return(false); } _labelName.Draw(batcher, x + 74, y); _labelPing.Draw(batcher, x + 250, y); _labelPacketLoss.Draw(batcher, x + 310, y); return(base.Draw(batcher, x, y)); }
public override bool Draw(Batcher2D batcher, Point position, Vector3?hue = null) { if (IsDisposed) { return(false); } _labelName.Draw(batcher, position + new Point(74, 10)); _labelPing.Draw(batcher, position + new Point(250, 10)); _labelPacketLoss.Draw(batcher, position + new Point(310, 10)); return(base.Draw(batcher, position, hue)); }
public override bool Draw(Batcher2D batcher, Point position, Vector3?hue = null) { if (IsDisposed || !SetName()) { return(false); } Point gWinPos = Engine.Profile.Current.GameWindowPosition; Point gWinSize = Engine.Profile.Current.GameWindowSize; float scale = Engine.SceneManager.GetScene <GameScene>().Scale; if (Entity is Mobile m) { GetAnimationDimensions(m, 0xFF, out int height, out int centerY); float x = (m.RealScreenPosition.X + gWinPos.X) / scale; float y = (m.RealScreenPosition.Y + gWinPos.Y) / scale; X = (int)(x + m.Offset.X) - (Width >> 1) + 22; Y = (int)(y + (m.Offset.Y - m.Offset.Z) - (height + centerY + 8)) - (Height >> 1) + (m.IsMounted ? 0 : 22); } else { X = (int)(Entity.RealScreenPosition.X / scale); Y = (int)(Entity.RealScreenPosition.Y / scale); } if (_edge == null) { _edge = new Texture2D(batcher.GraphicsDevice, 1, 1, false, SurfaceFormat.Color); _edge.SetData(new Color[] { Color.Gray }); } if (X < gWinPos.X || X + Width > gWinPos.X + gWinSize.X) { return(false); } if (Y < gWinPos.Y || Y + Height > gWinPos.Y + gWinSize.Y) { return(false); } position.X = X; position.Y = Y; batcher.DrawRectangle(_edge, new Rectangle(position.X - 1, position.Y - 1, Width + 1, Height + 1), Vector3.Zero); base.Draw(batcher, position, hue); return(_renderedText.Draw(batcher, new Rectangle(position.X + 2, position.Y + 2, Width, Height), 0, 0)); }
public override void Draw(SpriteBatchUI spriteBatch, Vector2Int position, double frameMS) { var hue = Key == WinKeys.None ? 33 : 2; if (IsEditable) { if (_renderedText.Width <= Width) { _renderedText.Draw(spriteBatch, position, Utility.GetHueVector(hue)); } else { var textOffset = _renderedText.Width - (Width); _renderedText.Draw(spriteBatch, new RectInt(position.x, position.y, _renderedText.Width - textOffset, _renderedText.Height), textOffset, 0, Utility.GetHueVector(hue)); } } else { _renderedText.Draw(spriteBatch, new RectInt(position.x, position.y, Width, Height), 0, 0, Utility.GetHueVector(hue)); } base.Draw(spriteBatch, position, frameMS); }
public override void Draw(SpriteBatchUI spriteBatch, Point position, double frameMS) { int hue = (Key == WinKeys.None) ? 33 : 2; if (IsEditable) { if (m_RenderedText.Width <= Width) { m_RenderedText.Draw(spriteBatch, position, Utility.GetHueVector(hue)); } else { int textOffset = m_RenderedText.Width - (Width); m_RenderedText.Draw(spriteBatch, new Rectangle(position.X, position.Y, m_RenderedText.Width - textOffset, m_RenderedText.Height), textOffset, 0, Utility.GetHueVector(hue)); } } else { m_RenderedText.Draw(spriteBatch, new Rectangle(position.X, position.Y, Width, Height), 0, 0, Utility.GetHueVector(hue)); } base.Draw(spriteBatch, position, frameMS); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { ResetHueVector(); ShaderHuesTraslator.GetHueVector(ref _hueVector, 0, false, 1.0f - _alpha / 255f, true); if (ProfileManager.Current != null && ProfileManager.Current.BuffBarTime) { batcher.Draw2D(Texture, x, y, ref _hueVector); return(_gText.Draw(batcher, x - 3, y + Texture.Height / 2 - 3, _hueVector.Z)); } else { return(batcher.Draw2D(Texture, x, y, ref _hueVector)); } }
public override bool Draw(Batcher2D batcher, int x, int y) { if (IsDisposed || !SetName()) { return(false); } Point gWinPos = Engine.Profile.Current.GameWindowPosition; Point gWinSize = Engine.Profile.Current.GameWindowSize; float scale = Engine.SceneManager.GetScene <GameScene>().Scale; if (Entity is Mobile m) { GetAnimationDimensions(m, 0xFF, out int height, out int centerY); float xx = (m.RealScreenPosition.X + gWinPos.X) / scale; float yy = (m.RealScreenPosition.Y + gWinPos.Y) / scale; X = (int)(xx + m.Offset.X) - (Width >> 1) + 22; Y = (int)(yy + (m.Offset.Y - m.Offset.Z) - (height + centerY + 8)) - (Height >> 1) + (m.IsMounted ? 0 : 22); } else { X = (int)(Entity.RealScreenPosition.X / scale) - (Width >> 1) + 22; Y = (int)(Entity.RealScreenPosition.Y / scale) - (Height >> 1); } if (X < gWinPos.X || X + Width > gWinPos.X + gWinSize.X) { return(false); } if (Y < gWinPos.Y || Y + Height > gWinPos.Y + gWinSize.Y) { return(false); } x = X; y = Y; batcher.DrawRectangle(Textures.GetTexture(Color.Gray), x - 1, y - 1, Width + 1, Height + 1, Vector3.Zero); base.Draw(batcher, x, y); return(_renderedText.Draw(batcher, x + 2, y + 2, Width, Height, 0, 0)); }
public override void Draw(SpriteBatchUI spriteBatch, Vector2Int position, double frameMS) { var texture = GetTextureFromMouseState(); if (Caption != string.Empty) { _texture.Text = Caption; } spriteBatch.Draw2D(texture, new RectInt(position.x, position.y, Width, Height), Vector3.zero); if (Caption != string.Empty) { var yoffset = MouseDownOnThis ? 1 : 0; _texture.Draw(spriteBatch, new Vector2Int( position.x + (Width - _texture.Width) / 2, position.y + yoffset + (Height - _texture.Height) / 2)); } base.Draw(spriteBatch, position, frameMS); }
public override void Draw(SpriteBatchUI spriteBatch, Point position, double frameMS) { Texture2D texture = GetTextureFromMouseState(); if (Caption != string.Empty) { m_Texture.Text = Caption; } spriteBatch.Draw2D(texture, new Rectangle(position.X, position.Y, Width, Height), Vector3.Zero); if (Caption != string.Empty) { int yoffset = MouseDownOnThis ? 1 : 0; m_Texture.Draw(spriteBatch, new Point( position.X + (Width - m_Texture.Width) / 2, position.Y + yoffset + (Height - m_Texture.Height) / 2)); } base.Draw(spriteBatch, position, frameMS); }
public override void Draw(SpriteBatchUI spriteBatch) { if (m_background) { if (m_backgroundTexture == null) { m_backgroundTexture = new Texture2D(spriteBatch.GraphicsDevice, 1, 1); m_backgroundTexture.SetData <Color>(new Color[] { Color.White }); } spriteBatch.Draw2D(m_backgroundTexture, new Rectangle(OwnerX + Area.X, OwnerY + Area.Y, Width, Height), 0, false, false); } m_Texture.ActiveRegion = m_hrefOver; m_Texture.ActiveRegion_UseDownHue = m_clicked; m_Texture.Draw(spriteBatch, new Rectangle(X, Y, Size.X, Size.Y), ScrollX, ScrollY); base.Draw(spriteBatch); }
protected override void OnDraw(double frameMS) { SceneManager.CurrentScene.Draw(_sb3D, _sbUI); _sbUI.GraphicsDevice.Clear(Color.Transparent); _sbUI.Begin(); _uiManager.Draw(_sbUI); _sb.Clear(); //_buffer.Clear(); _sb.ConcatFormat(FORMAT_1, CurrentFPS, SceneManager.CurrentScene.RenderedObjectsCount, _sb3D.Calls, _sb3D.Merged); _sb.ConcatFormat(FORMAT_2, _sb3D.FlushCount + _sbUI.FlushCount, World.Player == null ? string.Empty : World.Player.Position.ToString(), SceneManager.CurrentScene is GameScene gameScene && gameScene.SelectedObject != null ? gameScene.SelectedObject.ToString() : string.Empty, string.Empty); //_sb.ConcatFormat(FORMATTED_STRING, CurrentFPS, SceneManager.CurrentScene.RenderedObjectsCount, _sb3D.Calls, _sb3D.Merged, World.Player == null ? string.Empty : World.Player.Position.ToString(), SceneManager.CurrentScene is GameScene gameScene && gameScene.SelectedObject != null ? gameScene.SelectedObject.ToString() : string.Empty, string.Empty, _sb3D.FlushCount + _sbUI.FlushCount); _infoText.Text = _sb.ToString(); _infoText.Draw(_sbUI, new Point(Window.ClientBounds.Width - 150, 20)); _sbUI.End(); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { if (IsDisposed) { return(false); } ResetHueVector(); Rectangle scissor = ScissorStack.CalculateScissors ( Matrix.Identity, x, y, Width, Height ); if (ScissorStack.PushScissors(batcher.GraphicsDevice, scissor)) { batcher.EnableScissorTest(true); base.Draw(batcher, x, y); _gameText.Draw ( batcher, Width + ScrollX, Height + ScrollY, x, y, Width, Height, ScrollX, ScrollY ); batcher.EnableScissorTest(false); ScissorStack.PopScissors(batcher.GraphicsDevice); } return(true); }
public override void Draw(SpriteBatchUI spriteBatch) { Texture2D texture = getTextureFromMouseState(); if (Caption != string.Empty) { m_Texture.Text = Caption; } spriteBatch.Draw2D(texture, new Rectangle(X, Y, Width, Height), 0, false, false); if (Caption != string.Empty) { int yoffset = MouseDownOnThis ? 1 : 0; m_Texture.Draw(spriteBatch, new Point(X + (Width - m_Texture.Width) / 2, Y + yoffset + (Height - m_Texture.Height) / 2)); } base.Draw(spriteBatch); }
public bool Draw(SpriteBatchUI spriteBatch, Point position, Vector3?hue = null) { if (_gameObject != null && _hash != _gameObject.PropertiesHash) { _hash = _gameObject.PropertiesHash; Text = ReadProperties(_gameObject, out _textHTML); } if (string.IsNullOrEmpty(Text)) { return(false); } if (_renderedText == null) { _renderedText = new RenderedText() { Align = TEXT_ALIGN_TYPE.TS_CENTER, Font = 1, IsUnicode = true, IsHTML = true, Cell = 5, FontStyle = FontStyle.BlackBorder, }; } else if (_renderedText.Text != Text) { Fonts.RecalculateWidthByInfo = true; int width = Fonts.GetWidthUnicode(1, Text); if (width > 600) { width = 600; } _renderedText.MaxWidth = width; _renderedText.Text = _textHTML; Fonts.RecalculateWidthByInfo = false; } spriteBatch.Draw2D(CheckerTrans.TransparentTexture, new Rectangle((int)position.X - 4, (int)position.Y - 4, _renderedText.Width + 8, _renderedText.Height + 8), RenderExtentions.GetHueVector(0, false, 0.5f, false)); _renderedText.Draw(spriteBatch, position); return(true); }