public void Draw(RenderTarget target, RenderStates states) { if (!Active) { return; } BarText.Position = new Vector2f(Position.X, Position.Y - 4 - Size.Y); background.Position = Position; background.Size = Size; background.FillColor = new Color(128, 128, 128, 128); Bar.Position = BarPosition; Bar.Size = new Vector2f(MaxBarLength * Progress, BarHeight); Bar.FillColor = Color.White; if (Mouse.IsButtonPressed(Mouse.Button.Left) && BarColider.Contains(Mouse.GetPosition().X, Mouse.GetPosition().Y)) { onClick(); } background.Draw(target, states); Bar.Draw(target, states); BarText.Draw(target, states); }
public override void Draw(RenderTarget target, RenderStates states) { base.Draw(target, states); _sprite.Draw(target, states); _label.Draw(target, states); }
public void Draw(RenderWindow window) { _instructions.Draw(window, RenderStates.Default); _textRectangle.Draw(window, RenderStates.Default); _text.DisplayedString = _name; _text.Position = new Vector2f((_resX / 2) - (_text.DisplayedString.Length / 2 * (_text.CharacterSize * 0.53f)) - 50, _text.Position.Y); _text.Draw(window, RenderStates.Default); if (_confirmBox.Contains(Mouse.GetPosition(window).X, Mouse.GetPosition(window).Y)) { _confirm.Color = Color.Yellow; } else { _confirm.Color = Color.White; } _confirm.Draw(window, RenderStates.Default); if (_cancelBox.Contains(Mouse.GetPosition(window).X, Mouse.GetPosition(window).Y)) { _cancel.Color = Color.Yellow; } else { _cancel.Color = Color.White; } _cancel.Draw(window, RenderStates.Default); }
public void Draw(RenderTarget target, RenderStates states) { if (!HasFocus && Colider.Contains(Mouse.GetPosition().X, Mouse.GetPosition().Y) && Mouse.IsButtonPressed(Mouse.Button.Left)) { HasFocus = true; } else if (HasFocus && !Colider.Contains(Mouse.GetPosition().X, Mouse.GetPosition().Y) && Mouse.IsButtonPressed(Mouse.Button.Left)) { HasFocus = false; } Text.DisplayedString = TextString; var back = new RectangleShape() { Position = Position, Size = Size, FillColor = BackgroundColor, OutlineColor = OutlineColor, OutlineThickness = HasFocus ? 2 : 0 }; back.Draw(target, states); Text.Draw(target, states); //test.Draw(target, states); }
public override void Draw(RenderTarget target, RenderStates states) { base.Draw(target, states); Slider.Draw(target, states); Cross.Draw(target, states); }
internal void FillRectangle(object dc, IShapeRenderer renderer, IPointShape s, double radius, double dx, double dy, double scale) { _rectangle.StyleId = _fillStyleId; _rectangle.StartPoint.X = s.X - radius; _rectangle.StartPoint.Y = s.Y - radius; _rectangle.Point.X = s.X + radius; _rectangle.Point.Y = s.Y + radius; _rectangle.Draw(dc, renderer, dx, dy, scale, null, null); }
public void Draw(SpriteBatch spriteBatch) { var size = Font.GetSize(Text); var background = new Rectangle((int)Position.X, (int)Position.Y, size.Width, size.Height); RectangleShape.Draw(spriteBatch, background, Color.Black); spriteBatch.DrawString(Font, Text, Position, Color); }
public void Draw(RenderTarget target, RenderStates states) { states = new RenderStates(BlendMode.Alpha); UpdatePosition(bullet.Position + new Vector2f(1, 2)); //glow.Draw(target, states); bullet.Draw(target, states); }
public void Draw(RenderTarget target, RenderStates states) { test.Size = (new SFML.System.Vector2f(target.DefaultView.Size.X * 2 - test.OutlineThickness * 2, target.DefaultView.Size.Y * 2 - test.OutlineThickness * 2)); test.FillColor = colorRainbow.SwitchColorThrough(); test.Draw(target, states); }
private void DrawMiddleLine() { for (int i = -64; i < 600; i += 24) { RectangleShape middleLineSegment = new RectangleShape(new Vector2f(8, 8)); middleLineSegment.Position = new Vector2f(400, i); middleLineSegment.Draw(mainSFMLWindow, RenderStates.Default); } }
public override void Draw() { base.Draw(); var canvasSize = GameMgr.WindowManager.CanvasSize; Text.CurrentFont = ResourceHub.GetResource <IFont>("Fonts", "Arial"); Text.HorAlign = TextAlign.Left; Text.VerAlign = TextAlign.Top; // Description. if (CurrentFactory.Description != "") { var padding = 8; var textSize = Text.CurrentFont.MeasureString(CurrentFactory.Description); var origin = Vector2.UnitX * (canvasSize - (textSize + Vector2.One * padding * 2)); GraphicsMgr.CurrentColor = _barColor; RectangleShape.Draw(origin, origin + textSize + Vector2.One * padding * 2, false); GraphicsMgr.CurrentColor = _textColor; Text.Draw(CurrentFactory.Description, Vector2.One * padding + origin); } // Description. // Bottom bar. GraphicsMgr.VertexBatch.PushViewMatrix(); GraphicsMgr.VertexBatch.View = Matrix.CreateTranslation(new Vector3(0, canvasSize.Y - _barHeight, 0)) * GraphicsMgr.VertexBatch.View; GraphicsMgr.CurrentColor = _barColor; RectangleShape.Draw(Vector2.Zero, canvasSize, false); GraphicsMgr.CurrentColor = _textColor; Text.Draw( "fps: " + GameMgr.Fps + " | Current scene: " + CurrentScene.Name + Environment.NewLine + _prevSceneButton + "/" + _nextSceneButton + " - change scene, " + _restartButton + " - restart current scene, " + _toggleUIButton + " - toggle UI, " + _toggleFullscreenButton + " - toggle fullscreen" + Environment.NewLine + CameraController.UpButton + "/" + CameraController.DownButton + "/" + CameraController.LeftButton + "/" + CameraController.RightButton + " - move camera, " + CameraController.ZoomInButton + "/" + CameraController.ZoomOutButton + " - zoom, " + CameraController.RotateLeftButton + "/" + CameraController.RotateRightButton + " - rotate" , _indent ); GraphicsMgr.VertexBatch.PopViewMatrix(); // Bottom bar. }
/// <summary> /// Renders a shadow cast from the object /// </summary> /// <param name="def">The definition of the tile to use.</param> /// <param name="x">X position in world coordinates.</param> /// <param name="y">Y position in world coordinates.</param> public static void RenderPos(IEntity entity, float x, float y) { var tileSprite = entity.GetComponent <ISpriteComponent>().GetCurrentSprite(); var bounds = tileSprite.GetLocalBounds(); var shape = new RectangleShape(new Vector2f(bounds.Width, bounds.Height)); shape.FillColor = Color.Red; shape.Position = new Vector2f(x - bounds.Width / 2, y - bounds.Height / 2); shape.Draw(CluwneLib.CurrentRenderTarget, RenderStates.Default); }
/// <summary> /// Renders a shadow cast from the object /// </summary> /// <param name="occluder">The occluder component to use.</param> /// <param name="x">X position in world coordinates.</param> /// <param name="y">Y position in world coordinates.</param> public static void RenderPos(Box2 bounds, float x, float y) { var shape = new RectangleShape(new Vector2(bounds.Width, bounds.Height)) { FillColor = Color.Red, Position = new Vector2(x - bounds.Width / 2 + bounds.Left, y - bounds.Height / 2 + bounds.Top) }; shape.Draw(CluwneLib.CurrentRenderTarget, RenderStates.Default); }
public virtual void Draw(SpriteBatch spriteBatch) { var area = new Rectangle((int)Position.X, (int)Position.Y, Width, Height); RectangleShape.Draw(spriteBatch, area, Color); var textPosition = GetTextPosition(); spriteBatch.DrawString(font, Text, textPosition, Color.White); }
void Draw() { window.Clear(Color.Green); Circle.Draw(window, RenderStates.Default); Rectangle1.Draw(window, RenderStates.Default); Rectangle2.Draw(window, RenderStates.Default); window.Display(); }
/// <summary> /// Draws the robot's shapes. /// </summary> /// <param name="target">The render target.</param> /// <param name="states">The render state (default).</param> public void Draw(RenderTarget target, RenderStates states) { if (Simulation.HasStarted) { StartPoint.Draw(target, states); } EndPoint.Draw(target, states); _circle.Draw(target, states); _rectangle.Draw(target, states); }
public void Draw(RenderTarget target, RenderStates states) { background.Draw(target, states); backgroundBackground.Draw(target, states); backgroundSprite.Draw(target, states); edge.Draw(target, states); speakerSprite.Draw(target, states); shownText.Draw(target, states); }
private void Draw() { window.Clear(); Ball.FillColor = Color.Red; Ball.Draw(window, RenderStates.Default); LeftBat.Draw(window, RenderStates.Default); RightBat.Draw(window, RenderStates.Default); window.Display(); }
public void Draw(RenderTarget target, RenderStates states) { if (!IsActive) { return; } _renderView.Viewport = Core.WindowUtil.GetFractionalRect(new FloatRect(_getOrigin(), _displayRegion.Size)); target.SetView(_renderView); _displayRegion.Draw(target, states); _suggestionTexts.ForEach(a => a.Draw(target, states)); _selectionRect.Draw(target, states); target.SetView(target.DefaultView); }
public override void Draw(Component component) { var solid = (SolidComponent)component; var position = solid.Owner.GetComponent <PositionComponent>(); GraphicsMgr.CurrentColor = Color.Red; RectangleShape.Draw( position.Position.Round() - solid.Collider.Size / 2, position.Position.Round() + solid.Collider.Size / 2, true ); }
public void DrawExperience(RenderWindow window, Font font) { _expBarFilled.Size = new Vector2f(_expBar.Size.X * ((float)_experienceManager.GetPercentage() / 100f), _expBar.Size.Y); _expBar.Draw(window, RenderStates.Default); _expBarFilled.Draw(window, RenderStates.Default); Text level = new Text("Level : " + _experienceManager.Level.ToString(), font); level.Position = new Vector2f(_resolution.X - 32 * 15, _resolution.Y - 32); level.CharacterSize = 25; level.Style = Text.Styles.Bold; level.Draw(window, RenderStates.Default); }
public override void Draw(RenderTarget target, RenderStates states) { byte alphaColor = (byte)(255 - 255 * Opacity); _bodyShape.Position = Position; _bodyShape.FillColor = new Color(_color.R, _color.G, _color.B, alphaColor); _headShape.Position = Position + new Vector2(0, -15) + _currentHeadPosition; _headShape.FillColor = new Color(_color.R, _color.G, _color.B, alphaColor); _bodyShape.Draw(target, states); _headShape.Draw(target, states); }
public void DebugDraw(RenderTarget target, RenderStates states) { if (Path.Count > 0) { foreach (Point p in Path) { RectangleShape rect = new RectangleShape(new Vector2f(2, 2)); rect.Position = new Vector2f(p.X * 32, p.Y * 32); rect.FillColor = Color.Blue; rect.Draw(target, states); } } }
public void Rect(RectShapeHandle handle) { if (_rectShape == null) { _rectShape = new RectangleShape(); } _rectShape.Size = handle.Size; _rectShape.FillColor = handle.FillColor; _rectShape.OutlineThickness = handle.OutlineThickness; _rectShape.OutlineColor = handle.OutlineColor; _rectShape.Position = handle.Position; _rectShape.Draw(_win, RenderStates.Default); }
private void DrawLobbyUserSettings() { COLOR_SLIDER_RED.Draw(); COLOR_SLIDER_GREEN.Draw(); COLOR_SLIDER_BLUE.Draw(); RectangleShape playerNameInput = new RectangleShape(new Vector2f(350, 32)); playerNameInput.OutlineColor = Color.Magenta; playerNameInput.OutlineThickness = 1; playerNameInput.FillColor = Color.White; playerNameInput.Position = new Vector2f(64, 100); playerNameInput.Draw(mainSFMLWindow, RenderStates.Default); }
public void Draw(RenderTarget target, RenderStates states) { var bounds = _getBounds(); _text.Position = new Vector2f(_text.Position.X, _getBounds().Top); _cursor.Position = new Vector2f(_cursor.Position.X, bounds.Top + bounds.Height * (1 - cursorScale) / 2f); if (_selectionActive) { _selectionRect.Draw(target, states); } _cursor.FillColor = _getCursorColor(); _text.Draw(target, states); _cursor.Draw(target, states); line?.Draw(target, states); }
public void Draw(RenderTarget target, RenderStates states) { UpdateOpenness(); if (IsOpen) { _reportBackground.Position = new Vector2f(0, _closedYPos * (_currentOpenness - 1)); var bounds = _reportBackground.GetGlobalBounds(); _inputBackground.Position = new Vector2f(0, (int)(bounds.Top + bounds.Height)); _reportBackground.Draw(target, states); _reportText.Draw(target, states); _inputBackground.Draw(target, states); _inputText.Draw(target, states); _completer.Draw(target, states); } }
public void Draw(RenderTarget target, RenderStates states) { if (bDragging) { Vector2f _sizeOffset = curMouseRectPos - initMouseRectPos; selectionBox.Size = _sizeOffset; selectionBox.Draw(target, states); } foreach (RectangleShape _r in selectionRects) { if (_r != null) { _r.Draw(target, states); } } }
public void Draw(RenderTarget target, RenderStates states) { target.SetView(target.DefaultView); horizontalLines.Position = startingPosition; verticalLines.Position = startingPosition; while (horizontalLines.Position.Y < endPosition.Y) { horizontalLines.Draw(target, states); horizontalLines.Position += horizontalLineMoveVector; } while (verticalLines.Position.X < endPosition.X) { verticalLines.Draw(target, states); verticalLines.Position += verticalLineMoveVector; } }
private void DrawMultiPlayerButton() { RectangleShape multiButton = new RectangleShape(new Vector2f(200, 64)); multiButton.OutlineColor = Color.White; multiButton.OutlineThickness = 1; multiButton.FillColor = Color.Black; multiButton.Position = new Vector2f(125, 150); multiButton.Draw(mainSFMLWindow, RenderStates.Default); Text multiButtonText = new Text("Multi", baseFont); multiButtonText.FillColor = Color.White; multiButtonText.CharacterSize = 24; multiButtonText.Position = new Vector2f(175, 175); multiButtonText.Draw(mainSFMLWindow, RenderStates.Default); }