public void Draw(SpriteBatch batch, Vector2 position, Vector2 size, Vector2 containerSize, float alpha, SpriteFont defaultFont, Color?defaultColor, Color?defaultShadowColor) { SpriteFont font = defaultFont ?? Game1.smallFont; CachedFlow flow = GetFlow(font, WrapText ? size.X : -1); FlowHelper.RenderFlow(batch, flow, position, defaultColor, defaultShadowColor, lineOffset: 0); }
public Vector2 GetSize(SpriteFont defaultFont, Vector2 containerSize) { SpriteFont font = defaultFont ?? Game1.smallFont; CachedFlow flow = GetFlow(font, WrapText ? Math.Max(MinWidth, containerSize.X) : -1); Vector2 size = new(flow.Width, flow.Height); if (WrapText) { size.X = Math.Max(MinWidth, containerSize.X); } return(size); }
public void Draw(IFlowNodeSlice slice, SpriteBatch batch, Vector2 position, float scale, SpriteFont defaultFont, Color?defaultColor, Color?defaultShadowColor, CachedFlowLine line, CachedFlow flow) { if (Selected) { if (SelectedTexture != null) { RenderHelper.DrawBox( batch, SelectedTexture, SelectedSource ?? SelectedTexture.Bounds, (int)position.X + 2, (int)position.Y + 2, (int)slice.Width - 4, (int)slice.Height - 4, SelectedColor ?? Color.White, scale: 4f, drawShadow: false ); } } else if (Hovered) { if (HoverTexture != null) { RenderHelper.DrawBox( batch, HoverTexture, HoverSource ?? HoverTexture.Bounds, (int)position.X, (int)position.Y, (int)slice.Width, (int)slice.Height, HoverColor ?? Color.White, scale: 4f, drawShadow: false ); } } Hovered = false; if (Flow.HasValue) { FlowHelper.RenderFlow( batch, Flow.Value, new Vector2( position.X + 12, position.Y + 12 ), defaultColor, defaultShadowColor: defaultShadowColor, lineOffset: 0 ); } }
public void Draw(IFlowNodeSlice slice, SpriteBatch batch, Vector2 position, float scale, SpriteFont defaultFont, Color?defaultColor, Color?defaultShadowColor, CachedFlowLine line, CachedFlow flow) { if (slice is NestedNodeSlice tslice) { tslice.Slice.Node.Draw(tslice.Slice, batch, position, scale, defaultFont, defaultColor, defaultShadowColor, line, flow); } }
public void Draw(IFlowNodeSlice slice, SpriteBatch batch, Vector2 position, float scale, SpriteFont defaultFont, Color?defaultColor, Color?defaultShadowColor, CachedFlowLine line, CachedFlow flow) { if (IsEmpty()) { return; } Component.visible = true; int x = (int)position.X; int y = (int)position.Y; if (x != Component.bounds.X || y != Component.bounds.Y) { Component.bounds = new Rectangle( x, y, Component.bounds.Width, Component.bounds.Height ); } OnDraw?.Invoke(batch, position, scale, defaultFont, defaultColor, defaultShadowColor); if (Component is ClickableTextureComponent cp) { cp.draw(batch); } else if (Component is ClickableAnimatedComponent can) { can.draw(batch); } }
public void Draw(IFlowNodeSlice slice, SpriteBatch batch, Vector2 position, float scale, SpriteFont defaultFont, Color?defaultColor, Color?defaultShadowColor, CachedFlowLine line, CachedFlow flow) { if (IsEmpty()) { return; } int shadowOffset = (int)ShadowOffset; int x = (int)position.X; int y = (int)position.Y + (int)Padding; if (shadowOffset != 0) { batch.Draw( Game1.uncoloredMenuTexture, new Rectangle( x - shadowOffset, y + shadowOffset, (int)slice.Width, (int)Size ), new Rectangle(16, 272, 28, 28), ShadowColor ?? defaultShadowColor ?? Game1.textShadowColor ); } batch.Draw( Game1.uncoloredMenuTexture, new Rectangle( x, y, (int)slice.Width, (int)Size ), new Rectangle(16, 272, 28, 28), Color ?? defaultColor ?? Game1.textColor ); }
public void Draw(IFlowNodeSlice slice, SpriteBatch batch, Vector2 position, float scale, SpriteFont defaultFont, Color?defaultColor, Color?defaultShadowColor, CachedFlowLine line, CachedFlow flow) { if (IsEmpty()) { return; } Sprite.Draw(batch, position, scale * Scale, Frame, Size); }