public SpeechBubbleShape( Vector2f dimension, float radius, float outlineThickness, Color backgroundColor, Color outlineColor, Boolean tipMode = false, BorderType tipBorderType = DEFAULT_TIP_BORDER_TYPE, Boolean shadowMode = false, float shadowOffset = DEFAULT_SHADOW_OFFSET, float tipPosition = DEFAULT_TIP_POSITION, float tipSize = DEFAULT_TIP_SIZE) { Background = new Shape(); Background.EnableFill(true); Background.EnableOutline(true); Tip = new Shape(); Tip.EnableFill(true); Effect = new Shape(); Effect.EnableFill(true); Effect.EnableOutline(true); EffectTip = new Shape(); ShadowEffect = new Shape(); ShadowEffect.EnableFill(true); ShadowEffect.EnableOutline(true); ShadowEffectTip = new Shape(); ShadowEffectTip.EnableFill(true); ShadowEffectTip.EnableOutline(false); Dimension = dimension; ShadowMode = shadowMode; ShadowOffset = new Vector2f(shadowOffset, shadowOffset); Radius = radius; OutlineThickness = outlineThickness; AdjustSize(); TipMode = tipMode; TipBorderType = tipBorderType; BackgroundColor = backgroundColor; BackgroundColor.A = BACKGROUND_COLOR_ALPHA; OutlineColor = outlineColor; OutlineColor.A = BACKGROUND_COLOR_ALPHA; Background.OutlineThickness = OutlineThickness; Effect.OutlineThickness = OutlineThickness; ShadowEffect.OutlineThickness = OutlineThickness; TipPosition = tipPosition; TipSize = tipSize; Build(); }
public Particle(Vector2f pos, Vector2f direction, Shape shape, Color color, float speed = 0.1f, int lifeTime = 400) { S = shape; S.FillColor = color; IsAlive = true; D = direction; D = D / (float)Math.Sqrt(D.X * D.X + D.Y * D.Y); S.Position = pos; Speed = speed; LifeTime = lifeTime; }
public Bullet(Player owner, Vector direction, double damage) : base(Sorting.Group, "Bullets", 3) { Shape = new CircleShape(BodyRadius, 3); Shape.FillColor = BodyColor; Shape.Origin = new Vector2f(BodyRadius, BodyRadius); Direction = direction; Position = owner.Position + direction * Player.BodyRadius; Damage = damage; }
public Flame(Player owner, Vector direction, double damage) : base(Sorting.Group, "Flames", 0) { Owner = owner; BodyShape = new CircleShape(BodyRadius, 5); BodyShape.FillColor = BodyColor; BodyShape.Origin = new Vector2f(BodyRadius, BodyRadius); Direction = direction; Position = owner.Position + direction * Player.BodyRadius; Damage = damage; Game.Sounds.Prepare(ref SFX_FireLoop, "Campfire"); }
public BaseDrawableShape() : base() { Effects = new Dictionary<ShapeEffect, Shape>(); foreach (ShapeEffect effect in System.Enum.GetValues(typeof(ShapeEffect))) Effects.Add(effect, null); ShadowOffset = DEFAULT_SHADOW_OFFSET; OutlineThickness = 0F; BaseShape = new Shape(); BaseShape.EnableFill(true); }
public Corpse(float bodyRadius, float meleeRadius, Vector position, Vector facing) : base(Sorting.Group, "Corpses", -1) { BodyShape = new CircleShape(bodyRadius, 8); BodyShape.FillColor = Color; BodyShape.Origin = new Vector2f(bodyRadius, bodyRadius); MeleeShape = new CircleShape(meleeRadius, 3); MeleeShape.FillColor = Color; MeleeShape.Origin = new Vector2f(meleeRadius, meleeRadius); Position = position; MeleeShape.Rotation = (float)facing.Angle; MeleeShape.Position = (Vector2f)(Position + facing * meleeRadius * 2); }
public CombatCursorShape(uint size = CombatMap.CELL_SIZE) : base() { Size = (uint)(size * PERCENTAGE_SCALE_FACTOR / 100D); SideSquare = new Shape(); SideSquare.EnableFill(false); SideSquare.EnableOutline(true); SideSquare.OutlineThickness = 2; CenterSquare = new Shape(); CenterSquare.EnableFill(true); CenterSquare.EnableOutline(true); CenterSquare.OutlineThickness = 1; Build(); }
//////////////////////////////////////////////////////////// /// <summary> /// Construct the shape from another shape /// </summary> /// <param name="copy">Shape to copy</param> //////////////////////////////////////////////////////////// public Shape(Shape copy) : base(IntPtr.Zero) { myGetPointCountCallback = new GetPointCountCallbackType(InternalGetPointCount); myGetPointCallback = new GetPointCallbackType(InternalGetPoint); CPointer = sfShape_create(myGetPointCountCallback, myGetPointCallback, IntPtr.Zero); Origin = copy.Origin; Position = copy.Position; Rotation = copy.Rotation; Scale = copy.Scale; Texture = copy.Texture; TextureRect = copy.TextureRect; FillColor = copy.FillColor; OutlineColor = copy.OutlineColor; OutlineThickness = copy.OutlineThickness; }
//////////////////////////////////////////////////////////// /// <summary> /// Construct the shape from another shape /// </summary> /// <param name="copy">Shape to copy</param> //////////////////////////////////////////////////////////// public Shape(Shape copy) : base(sfShape_Copy(copy.This)) { }
public Particle(Vector2f pos, Vector2f direction, Shape shape) : this(pos, direction, shape, Color.Red) { }
private static void render_poly(Sprite spr) { sfml_shape = new Shape(); sfml_shape.BlendMode = (BlendMode)spr.blit.mode; var col = familiarize_color(spr.blit.color); sfml_shape.Color = SFML.Graphics.Color.White; for (int i = 0, n = spr.points.Length; i < n; i++) { sfml_shape.AddPoint(new Vector2f(spr.points[i].x, spr.points[i].y), col); } spr.effect.prepare(); //var rt = spr.render_target_override ?? render_target; render_target.Draw(sfml_shape, spr.effect.shader.sfml_shader_object); }
void UpdateCurrentPoint() { AdjustPoints(); FloatRect rect = GetRect(); Vector2f topLeftPoint = Holder.GetGlobalFromLocal(new Vector2f(rect.Left, rect.Top)); Vector2f bottomRight = Holder.GetGlobalFromLocal(new Vector2f(rect.Right, rect.Bottom)); SelectionShape = GetShape(topLeftPoint.X, topLeftPoint.Y, bottomRight.X, bottomRight.Y); }
void MoveCurrentPointTo(Vector2f point) { Vector2f oldCurrentPoint = CurrentPoint; CurrentPoint = point; if (oldCurrentPoint.X != CurrentPoint.X || oldCurrentPoint.Y != CurrentPoint.Y) AdjustPoints(); Vector2f originPoint = Holder.GetGlobalFromLocal(GetTopLeftPoint()); Vector2f endPoint = Holder.GetGlobalFromLocal(GetBottomRightPoint()); SelectionShape = GetShape(originPoint.X, originPoint.Y, endPoint.X, endPoint.Y); }
public Selector( Widget holder, Boolean fillEnabled = false, Boolean outlineEnabled = true, Boolean constantDrawing = false) : base() { Holder = holder; if (Holder != null) Holder.AddWidget(this); HolderOffset = new FloatRect(); IsActive = false; FillColor = DEFAULT_FILL_COLOR; OutlineColor = DEFAULT_OUTLINE_COLOR; OutlineThickness = DEFAULT_OUTLINE_THICKNESS; ConstantDrawing = constantDrawing; MoveOffset = DEFAULT_MOVE_OFFSET; MoveIsEnabled = true; SelectionShape = new Shape(); SelectionShape.EnableFill(fillEnabled); SelectionShape.EnableOutline(outlineEnabled); SelectionShape.OutlineThickness = OutlineThickness; }
protected void SetEffect(ShapeEffect effect, bool active = true) { if (!active) { Effects[effect] = null; return; } Effects[effect] = new Shape(); Effects[effect].EnableFill(true); Color = Color; }