protected override void Initialize() { if (GraphicManager.GraphicsDevice.Adapter.IsProfileSupported(GraphicsProfile.HiDef)) { GraphicManager.GraphicsProfile = GraphicsProfile.HiDef; } GraphicManager.ApplyChanges(); SetRefreshRate(Settings.GlobalSettings.FPS); _uoSpriteBatch = new UltimaBatcher2D(GraphicsDevice); _filter = HandleSdlEvent; SDL_AddEventWatch(_filter, IntPtr.Zero); base.Initialize(); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { ResetHueVector(); if (MaxValue != MinValue) { batcher.Draw2D(Texture, x, (int)(y + _sliderPosition), ref _hueVector); } if (_showButtons) { batcher.Draw2D(_upButton, x, y, ref _hueVector); batcher.Draw2D(_downButton, x, y + Height, ref _hueVector); } return(base.Draw(batcher, x, y)); }
protected static void DrawLand ( UltimaBatcher2D batcher, ushort graphic, int x, int y, ref UltimaBatcher2D.YOffsets yOffsets, ref Vector3 nTop, ref Vector3 nRight, ref Vector3 nLeft, ref Vector3 nBottom, Vector3 hue, float depth ) { var texture = TexmapsLoader.Instance.GetLandTexture(TileDataLoader.Instance.LandData[graphic].TexID, out var bounds); if (texture != null) { batcher.DrawStretchedLand ( texture, new Vector2(x, y), bounds, ref yOffsets, ref nTop, ref nRight, ref nLeft, ref nBottom, hue, depth + 0.5f ); } else { DrawStatic ( batcher, graphic, x, y, hue, depth ); } }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); if (ShowLock) { ResetHueVector(); UOTexture lock_texture = GumpsLoader.Instance.GetTexture(0x082C); if (lock_texture != null) { lock_texture.Ticks = Time.Ticks; if (UIManager.MouseOverControl != null && (UIManager.MouseOverControl == this || UIManager.MouseOverControl.RootParent == this)) { _hueVector.X = 34; _hueVector.Y = 1; } batcher.Draw2D(lock_texture, x + (Width - lock_texture.Width), y, ref _hueVector); } } ResetHueVector(); if (_anchorCandidate != null) { Point drawLoc = UIManager.AnchorManager.GetCandidateDropLocation(this, _anchorCandidate); if (drawLoc != Location) { Texture2D previewColor = Texture2DCache.GetTexture(Color.Silver); ResetHueVector(); _hueVector.Z = 0.5f; batcher.Draw2D(previewColor, drawLoc.X, drawLoc.Y, Width, Height, ref _hueVector); _hueVector.Z = 0; // double rectangle for thicker "stroke" batcher.DrawRectangle(previewColor, drawLoc.X, drawLoc.Y, Width, Height, ref _hueVector); batcher.DrawRectangle(previewColor, drawLoc.X + 1, drawLoc.Y + 1, Width - 2, Height - 2, ref _hueVector); } } return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { if (IsDisposed) { return(false); } if (MouseIsOver) { ResetHueVector(); ShaderHueTranslator.GetHueVector(ref _hueVector, 0, false, Alpha, true); batcher.Draw2D(_texture, x, y, 0, 0, Width, Height, ref _hueVector); } return(base.Draw(batcher, x, y)); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { ResetHueVector(); base.Draw(batcher, x, y); ResetHueVector(); batcher.DrawRectangle(Texture2DCache.GetTexture(Color.Gray), x, y + 15, Width, Height - 15, ref _hueVector); if (_texture.MouseIsOver) { _hueVector.Z = 0.7f; batcher.Draw2D(Texture2DCache.GetTexture(Color.Yellow), x + 1, y + 15, Width - 1, Height - 15, ref _hueVector); _hueVector.Z = 0; } return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { if (ProfileManager.Current == null || Mobile == null || Mobile.IsDestroyed) { return(false); } float scale = Client.Game.GetScene <GameScene>().Scale; int gx = ProfileManager.Current.GameWindowPosition.X; int gy = ProfileManager.Current.GameWindowPosition.Y; int w = ProfileManager.Current.GameWindowSize.X; int h = ProfileManager.Current.GameWindowSize.Y; x = gx + Mobile.RealScreenPosition.X; y = gy + Mobile.RealScreenPosition.Y; x += (int)Mobile.Offset.X + 22; y += (int)(Mobile.Offset.Y - Mobile.Offset.Z) + 22; x = (int)(x / scale); y = (int)(y / scale); x -= (int)(gx / scale); y -= (int)(gy / scale); x += gx; y += gy; x -= 12; X = x; Y = y; if (x < gx || x + Width > gx + w) { return(false); } if (y < gy || y + Height > gy + h) { return(false); } return(base.Draw(batcher, x, y)); }
protected static void DrawLand ( UltimaBatcher2D batcher, ushort graphic, int x, int y, ref Rectangle rectangle, ref Vector3 n0, ref Vector3 n1, ref Vector3 n2, ref Vector3 n3, ref Vector3 hue ) { UOTexture texture = TexmapsLoader.Instance.GetTexture(TileDataLoader.Instance.LandData[graphic].TexID); if (texture != null) { texture.Ticks = Time.Ticks; batcher.DrawSpriteLand ( texture, x, y, ref rectangle, ref n0, ref n1, ref n2, ref n3, ref hue ); } else { DrawStatic ( batcher, graphic, x, y, ref hue ); } }
public void Draw(UltimaBatcher2D batcher, int x, int y, float scale) { if (IsDestroyed || _messages.Count == 0) { return; } int screenX = Engine.Profile.Current.GameWindowPosition.X; int screenY = Engine.Profile.Current.GameWindowPosition.Y; int screenW = Engine.Profile.Current.GameWindowSize.X; int screenH = Engine.Profile.Current.GameWindowSize.Y; x += Parent.RealScreenPosition.X; y += Parent.RealScreenPosition.Y; int offY = 0; if (Parent is Mobile m) { if (!m.IsMounted) { offY = -22; } GetAnimationDimensions(m, 0, out int centerX, out int centerY, out int width, out int height); x += (int)m.Offset.X; x += 22; y += (int)(m.Offset.Y - m.Offset.Z - (height + centerY + 8)); } else if (Parent.Texture != null) { if (Parent is Item it && it.IsCorpse) { offY = -22; } else if (Parent is Static || Parent is Multi) { offY = -44; } x += 22; y -= Parent.Texture.Height >> 1; }
protected static void DrawLand ( UltimaBatcher2D batcher, ushort graphic, int x, int y, ref UltimaBatcher2D.YOffsets yOffsets, ref Vector3 nTop, ref Vector3 nRight, ref Vector3 nLeft, ref Vector3 nBottom, ref Vector3 hue ) { UOTexture texture = TexmapsLoader.Instance.GetTexture(TileDataLoader.Instance.LandData[graphic].TexID); if (texture != null) { texture.Ticks = Time.Ticks; batcher.DrawSpriteLand ( texture, x, y, ref yOffsets, ref nTop, ref nRight, ref nLeft, ref nBottom, ref hue ); } else { DrawStatic ( batcher, graphic, x, y, ref hue ); } }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { if (Engine.Profile.Current != null && Engine.Profile.Current.UseXBR) { // draw regular world if (_xBR == null || _xBR.IsDisposed) { _xBR = new MatrixEffect(batcher.GraphicsDevice, Resources.xBREffect); } _xBR.Parameters["textureSize"].SetValue(new Vector2 { X = _scene.ViewportTexture.Width, Y = _scene.ViewportTexture.Height }); batcher.End(); batcher.Begin(_xBR); batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _zero); batcher.End(); batcher.Begin(); } else { batcher.Draw2D(_scene.ViewportTexture, x, y, Width, Height, ref _zero); } // draw lights if (_scene.UseLights) { batcher.SetBlendState(_blend); batcher.Draw2D(_scene.Darkness, x, y, Width, Height, ref _zero); batcher.SetBlendState(null); } // draw overheads _scene.DrawSelection(batcher, x, y); _scene.DrawOverheads(batcher, x, y); return(base.Draw(batcher, x, y)); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { //batcher.SetBlendState(_checkerBlend.Value); //batcher.SetStencil(_checkerStencil.Value); //batcher.Draw2D(TransparentTexture, new Rectangle(position.X, position.Y, Width, Height), Vector3.Zero /*ShaderHuesTraslator.GetHueVector(0, false, 0.5f, false)*/); //batcher.SetBlendState(null); //batcher.SetStencil(null); //return true; Vector3 hue = Vector3.Zero; hue.Z = 0.5f; return(batcher.Draw2D(Textures.GetTexture(Color.Black), x, y, Width, Height, ref hue)); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { base.Draw(batcher, x, y); //TextRenderer.MoveToTopIfSelected(); TextRenderer.ProcessWorldText(true); TextRenderer.Draw ( batcher, x, y, -1, true ); return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { if (!string.IsNullOrWhiteSpace(_label.Text) && MouseIsOver) { ResetHueVector(); batcher.Draw2D(Texture2DCache.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 static void Draw(UltimaBatcher2D batcher) { SortControlsByInfo(); batcher.GraphicsDevice.Clear(Color.Transparent); batcher.Begin(); for (int i = Gumps.Count - 1; i >= 0; i--) { Control g = Gumps[i]; g.Draw(batcher, g.X, g.Y); } GameCursor?.Draw(batcher); batcher.End(); }
public static void Draw(UltimaBatcher2D batcher) { SortControlsByInfo(); batcher.GraphicsDevice.Clear(Color.Black); batcher.Begin(); for (var last = Gumps.Last; last != null; last = last.Previous) { var g = last.Value; g.Draw(batcher, g.X, g.Y); } GameCursor?.Draw(batcher); batcher.End(); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { if (Item == null || Item.IsDestroyed) { Dispose(); } if (IsDisposed) { return(false); } ResetHueVector(); ShaderHuesTraslator.GetHueVector(ref _hueVector, Item.Hue & 0x3FFF, _isPartialHue, Alpha, true); return(batcher.Draw2D(Texture, x, y, ref _hueVector)); }
protected static void DrawStatic(UltimaBatcher2D batcher, ushort graphic, int x, int y, ref Vector3 hue) { ArtTexture texture = ArtLoader.Instance.GetTexture(graphic); if (texture != null) { texture.Ticks = Time.Ticks; ref UOFileIndex index = ref ArtLoader.Instance.GetValidRefEntry(graphic + 0x4000); batcher.DrawSprite ( texture, x - index.Width, y - index.Height, false, ref hue ); }
protected static void DrawLand(UltimaBatcher2D batcher, ushort graphic, int x, int y, ref Vector3 hue) { UOTexture texture = ArtLoader.Instance.GetLandTexture(graphic); if (texture != null) { texture.Ticks = Time.Ticks; batcher.DrawSprite ( texture, x, y, false, ref hue ); } }
public virtual void Draw(UltimaBatcher2D batcher, int startX, int startY, int renderIndex, bool isGump = false) { ProcessWorldText(false); int mouseX = Mouse.Position.X; int mouseY = Mouse.Position.Y; TextOverhead last = null; for (var o = _drawPointer; o != null; o = o.DLeft) { if (o.RenderedText == null || o.RenderedText.IsDestroyed || o.RenderedText.Texture == null || o.Time < Time.Ticks || (o.Owner.UseInRender != renderIndex && !isGump)) { continue; } ushort hue = 0; float alpha = 1f - o.Alpha / 255f; if (o.IsTransparent) { if (o.Alpha == 0xFF) { alpha = 1f - 0x7F / 255f; } } if (o.RenderedText.Texture.Contains(mouseX - startX - o.RealScreenPosition.X, mouseY - startY - o.RealScreenPosition.Y)) { SelectedObject.Object = o; last = o; if (!isGump && o.Owner is Entity) { hue = 0x0035; } } o.RenderedText.Draw(batcher, startX + o.RealScreenPosition.X, startY + o.RealScreenPosition.Y, alpha, hue); } MoveToTop(last); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { Vector3 hueVector = ShaderHueTranslator.GetHueVector(Hue, false, Alpha); batcher.Draw ( SolidColorTextureCache.GetTexture(Color.Black), new Rectangle ( x, y, Width, Height ), hueVector ); return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { if (_graphic != 0) { var texture = ArtLoader.Instance.GetStaticTexture(_graphic, out var bounds); Vector3 hueVector = ShaderHueTranslator.GetHueVector(_hue, _isPartial, 1f); batcher.Draw ( texture, new Vector2(x, y), bounds, hueVector ); } return(base.Draw(batcher, x, y)); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { Vector3 hueVector = ShaderHueTranslator.GetHueVector(0, false, Alpha); batcher.Draw ( _texture, new Rectangle ( x, y, Width, Height ), hueVector ); return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { if (DrawBackgroundCurrentIndex && MouseIsOver && !string.IsNullOrWhiteSpace(Text)) { ResetHueVector(); batcher.Draw2D ( SolidColorTextureCache.GetTexture(Color.Gray), x, y + 2, Width - 4, Height - 4, ref HueVector ); } return(base.Draw(batcher, x, y)); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { ResetHueVector(); ShaderHueTranslator.GetHueVector(ref HueVector, 0, false, Alpha, true); int middleWidth = Width - _gumpTexture[0].Width - _gumpTexture[2].Width; batcher.Draw2D(_gumpTexture[0], x, y, ref HueVector); batcher.Draw2DTiled ( _gumpTexture[1], x + _gumpTexture[0].Width, y, middleWidth, _gumpTexture[1].Height, ref HueVector ); batcher.Draw2D(_gumpTexture[2], x + Width - _gumpTexture[2].Width, y, ref HueVector); return(base.Draw(batcher, x, y)); }
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 bool Draw(UltimaBatcher2D batcher, int x, int y) { var scrollbar = Children[0]; scrollbar.Draw(batcher, x + scrollbar.X, y + scrollbar.Y); Rectangle scissor = ScissorStack.CalculateScissors(Matrix.Identity, x + ScissorRectangle.X, y + ScissorRectangle.Y, (Width - 14) + ScissorRectangle.Width, Height + ScissorRectangle.Height); if (ScissorStack.PushScissors(scissor)) { batcher.EnableScissorTest(true); int height = ScissorRectangle.Y; for (int i = 1; i < Children.Count; i++) { Control child = Children[i]; if (!child.IsVisible) { continue; } child.Y = height - _scrollBar.Value; if (height + child.Height <= _scrollBar.Value) { // do nothing } else { child.Draw(batcher, x + child.X, y + child.Y); } height += child.Height; } batcher.EnableScissorTest(false); ScissorStack.PopScissors(); } return(true); }
public override bool Draw(UltimaBatcher2D batcher, int posX, int posY) { if (IsDestroyed) { return(false); } ResetHueVector(); if (AnimationGraphic != _displayedGraphic || Texture == null || Texture.IsDisposed) { _displayedGraphic = AnimationGraphic; Texture = FileManager.Art.GetTexture(AnimationGraphic); Bounds.X = 0; Bounds.Y = 0; Bounds.Width = Texture.Width; Bounds.Height = Texture.Height; } Bounds.X = (int)-Offset.X + 22; Bounds.Y = (int)(Offset.Z - Offset.Y) + 22; Rotation = AngleToTarget; if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange) { HueVector.X = Constants.OUT_RANGE_COLOR; HueVector.Y = 1; } else if (World.Player.IsDead && Engine.Profile.Current.EnableBlackWhiteEffect) { HueVector.X = Constants.DEAD_RANGE_COLOR; HueVector.Y = 1; } else { ShaderHuesTraslator.GetHueVector(ref HueVector, Hue); } Engine.DebugInfo.EffectsRendered++; base.Draw(batcher, posX, posY); ref readonly StaticTiles data = ref FileManager.TileData.StaticData[_displayedGraphic];
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { ScrollBarBase scrollbar = (ScrollBarBase)Children[0]; scrollbar.Draw(batcher, x + scrollbar.X, y + scrollbar.Y); Rectangle scissor = ScissorStack.CalculateScissors ( Matrix.Identity, x + ScissorRectangle.X, y + ScissorRectangle.Y, Width - 14 + ScissorRectangle.Width, Height + ScissorRectangle.Height ); if (ScissorStack.PushScissors(batcher.GraphicsDevice, scissor)) { batcher.EnableScissorTest(true); for (int i = 1; i < Children.Count; i++) { Control child = Children[i]; if (!child.IsVisible) { continue; } int finalY = y + child.Y - scrollbar.Value + ScissorRectangle.Y; //if (finalY + child.Bounds.Height >= scissor.Y && finalY - child.Height < scissor.Bottom) { child.Draw(batcher, x + child.X, finalY); } } batcher.EnableScissorTest(false); ScissorStack.PopScissors(batcher.GraphicsDevice); } return(true); }
public override bool Draw(UltimaBatcher2D batcher, int x, int y) { if (!base.Draw(batcher, x, y)) { return(false); } Vector3 hueVector = ShaderHueTranslator.GetHueVector(0); batcher.DrawString ( Fonts.Bold, _cacheText, x + 10, y + 10, hueVector ); return(true); }