public override void Draw(RenderTarget target, RenderStates states) { float triangleSizeM = 4.5f; if (text.DisplayedString != "0") { base.Draw(target, states); if (direction != 0) { CircleShape triangle = new CircleShape(Size.Y * triangleSizeM, 3) { Origin = new Vector2f(Size.Y * triangleSizeM, Size.Y * triangleSizeM), Position = Position - (Position - p2) / 5 * (direction == 1 ? 2 : 3), Rotation = direction == 1 ? -90 + Rotation : 90 + Rotation, OutlineThickness = Size.Y / 2, FillColor = Selected ? Color.Yellow : FillColor, OutlineColor = OutlineColor }; target.Draw(triangle, states); triangle.Dispose(); text.Position = Position - (Position - p2) / 5 * (direction == 1 ? 2 : 3); } else { text.Position = Position - (Position - p2) / 2; } text.Origin = new Vector2f(text.GetLocalBounds().Width / 2f, text.GetLocalBounds().Height / 2f); text.CharacterSize = (uint)Size.Y * 5; text.Color = TextColor; target.Draw(text, states); text.Dispose(); } }
protected override void Dispose(bool disposing) { if (m_disposed || !Initialized) { return; } if (disposing) { if (m_bodyShape != null) { m_bodyShape.Dispose(); } if (m_bodyFillShape != null) { m_bodyFillShape.Dispose(); } if (m_trackShape != null) { m_trackShape.Dispose(); } if (m_barrelShape != null) { m_barrelShape.Dispose(); } if (m_turretShape != null) { m_turretShape.Dispose(); } } m_disposed = true; base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { CircleShape.Dispose(); LabelPaint.Dispose(); textBoundsRect.Dispose(); } base.Dispose(disposing); }
public override void Render(RenderTarget buffer, Texture texture) { CircleShape shape = new CircleShape(Radius) { FillColor = Color }; shape.SetPointCount((uint)FloorInt(Radius / 1.2f)); shape.Position = Position - new Vector2f(Radius, Radius); buffer.Draw(shape); shape.Dispose(); }
/// <summary> /// Destructor of the Projectile /// </summary> /// <param name="iDistanceDetection">Radius of Sight of the Enemy</param> /// <returns>Bool whether Projectile has been destroyed or not</returns> public bool Destruct(int iDistanceDetection) { if (SimpleCollisionDetection(cShape.Position, 1, 1) || Utilities.DistanceBetweenVectors(StartPosition, vEntityPosition) > iDistanceDetection) { tEntity.Dispose(); cShape.Dispose(); return(true); } else { return(false); } }
public void Draw(RenderTarget target, RenderStates states) { Text text = new Text("0", font); CircleShape circle = new CircleShape(20) { Origin = new Vector2f(20, 20), OutlineThickness = 4, FillColor = FillColor, OutlineColor = IsSink ? Color.Red : IsSource ? Color.Green : Selected ? Color.Yellow : OutlineColor //XD }; circle.Position = Position; text.DisplayedString = number.ToString(); text.Origin = new Vector2f(text.GetLocalBounds().Width / 1.6f, text.GetLocalBounds().Height / 1.15f); text.Position = Position; text.Color = circle.OutlineColor; target.Draw(circle, states); target.Draw(text, states); circle.Dispose(); text.Dispose(); }
private void GameLoop() { oldTime = newTime; newTime = clock.ElapsedTime; deltaTime = (newTime.AsMicroseconds() - oldTime.AsMicroseconds()) / 1000f; if (!Exit && window.IsOpen) { window.DispatchEvents(); } absMousePos = Mouse.GetPosition(window); mousePos = absMousePos; mousePos.X += (int)(window.GetView().Center.X - window.Size.X / 2); window.Clear(windowColor); int hoverIndex = (int)(mousePos.X / (IntTileWidth + 1)); bool hover = mousePos.X >= 0 && mousePos.X <= window.Size.X && mousePos.Y >= 0 && mousePos.Y <= window.Size.Y; window.Draw(startRect); bool even = false; for (int i = Math.Max(ToEven(firstVisibleIndex - 1), 0); i < Math.Min(firstVisibleIndex + maxTiles, Series[0].Count); i++) { Color prev = even ? EvenColor : OddColor; brect.FillColor = i == hoverIndex && hover ? HighColor : prev; brect.Position = new Vector2f(i * (IntTileWidth + 1), 0); window.Draw(brect); even = !even; } for (int i = 0; i < 8; i++) { float y = i * (TileHeight + 1); Serie cur = Series[i]; for (int d = firstVisibleIndex; d < firstVisibleIndex + maxTiles + 1; d++) { if (d >= 0 && cur.Count > d) { rect.Position = new Vector2f(d * (IntTileWidth + 1), y); if (d == hoverIndex && hover) { rect.FillColor = cur.TileColorHL; } else { rect.FillColor = cur.TileColor; } if (cur[d].Value) { window.Draw(rect); } } } cur = null; } textHoverTime.Position = new Vector2f(absMousePos.X + 3f + (v.Center.X - window.Size.X / 2), absMousePos.Y + 3); textHoverTime.DisplayedString = (Series.Count > hoverIndex && hoverIndex >= 0) ? Series.GetTime(hoverIndex).ToString(@"hh\:mm\:ss") : ""; window.Draw(textHoverTime); if (Running && visibleTileCount >= maxTiles) { float step = (float)((IntTileWidth + 1) / ((double)UpdateInterval / deltaTime)); MoveView(step); } if (firstVisibleIndex > Series.Count - 1) { CircleShape s = new CircleShape(10, 3); s.FillColor = Color.Black; s.Rotation = 270; for (int i = 0; i < 2; i++) { s.Position = new Vector2f(v.Center.X - window.Size.X / 2 + 15, (window.Size.Y / 4) * (i == 0 ? 1 : 3)); window.Draw(s); } s.Dispose(); } window.Display(); }
protected override void OnDispose() { body.Dispose(); base.OnDispose(); }
public void Dispose() { target.Dispose(); targetLineX.Dispose(); targetLineY.Dispose(); }
protected override void OnDispose() { orbitDisplay.Dispose(); base.OnDispose(); }