protected override void Render(Renderer renderer, Time time) { if (IsVisible && time.CheckEvery(DoDamageEvery)) DoDamage(); base.Render(renderer, time); }
private void DrawImage(Time time) { var sprite = GetCurrentSprite(time); var heightSprite = 1.0f / Image.PixelSize.Height * sizeSprite.Height; var widthSprite = 1.0f / Image.PixelSize.Width * sizeSprite.Width; CalculateCornersAndPaint(sprite, widthSprite, heightSprite); }
protected override void Render(Renderer renderer, Time time) { Rotation += rotationSpeed * time.CurrentDelta; DrawArea.Center += velocity * time.CurrentDelta; velocity.ReflectIfHittingBorder(DrawArea, renderer.Screen.Viewport); base.Render(renderer, time); }
protected override void Render(Renderer renderer, Time time) { renderer.DrawLine(DrawArea.TopLeft, DrawArea.TopRight, Color); renderer.DrawLine(DrawArea.TopRight, DrawArea.BottomRight, Color); renderer.DrawLine(DrawArea.BottomRight, DrawArea.BottomLeft, Color); renderer.DrawLine(DrawArea.BottomLeft, DrawArea.TopLeft, Color); }
protected override void Render(Renderer renderer, Time time) { MoveSprite(); Color.AlphaValue = 1.0f - elapsed / timeout; base.Render(renderer, time); CheckIfTimeToDispose(time); }
public LogoGame(Renderer render, Time time, Window window) { box = new ColoredRectangle(render, Point.Half, Size.Half, Color.Red); this.time = time; this.window = window; window.BackgroundColor = Color.CornflowerBlue; }
protected override void Render(Renderer renderer, Time time) { var gravity = new Point(0.0f, 9.81f); if (DrawArea.Bottom < renderer.Screen.Bottom) velocity += gravity * 0.2f * time.CurrentDelta; base.Render(renderer, time); }
protected override void Render(Renderer renderer, Time time) { var rotSpeed = RotationSpeed * time.CurrentDelta; if (Rotation < 0 - rotSpeed) Rotation += rotSpeed; base.Render(renderer, time); }
protected override void Render(Renderer renderer, Time time) { screen = renderer.Screen; if (Rotation == 0.0f) DrawImage(); else DrawImageWithRotation(); }
protected override void Render(Renderer renderer, Time time) { if (areCachedLinesOutOfDate) CacheLines(); foreach (Line2D line in lines) renderer.DrawLine(TopLeft + line.StartPosition, TopLeft + line.EndPosition, Color); }
protected override void Render(Renderer renderer, Time time) { if (areEllipsePointsOutOfDate) StoreEllipsePoints(); for (int i = 1; i < ellipsePoints.Length; i++) renderer.DrawLine(Center + ellipsePoints[i - 1], Center + ellipsePoints[i], Color); }
protected override void Render(Renderer renderer, Time time) { xPosition = xPosition.Clamp(renderer.Screen.Left + HalfWidth, renderer.Screen.Right - HalfWidth); var yPosition = renderer.Screen.GetInnerPoint(0.5f, 0.9f).Y; DrawArea = Rectangle.FromCenter(xPosition, yPosition, Width, Height); base.Render(renderer, time); }
protected override void Render(Renderer renderer, Time time) { Color.AlphaValue = 1.0f - elapsed / timeout; base.Render(renderer, time); elapsed += time.CurrentDelta; if (elapsed >= timeout) Dispose(); }
public Game(Content content, Renderer renderer, Time time, Score score, RabbitsGrid rabbits) { gameOverImage = content.Load<Image>("GameOver"); this.time = time; this.score = score; this.renderer = renderer; this.rabbits = rabbits; rabbits.InitializeRabbits(); }
private Point GetCurrentSprite(Time time) { frameOffset += time.CurrentDelta; if (frameOffset > spriteTime) { frameNumber = (frameNumber + 1) % frames.Length; frameOffset = 0; } return frames[frameNumber]; }
public RabbitsGrid(Content content, Renderer renderer, Time time, Score score) : base(GetColumns(renderer.Screen.Viewport), GetRows(renderer.Screen.Viewport)) { rabbitImage = content.Load<Image>("Rabbit"); deadRabbitImage = content.Load<Image>("DeadRabbit"); malletHitSound = content.Load<Sound>("MalletHit"); malletBloodImage = content.Load<Image>("BloodSplatter"); this.renderer = renderer; this.score = score; this.time = time; }
protected override void Render(Renderer renderer, Time time) { float frictionMultiplier = 1.0f - FrictionFactorPerSecond * time.CurrentDelta; velocity *= frictionMultiplier; rotationSpeed *= frictionMultiplier; Point remVelocity = velocity; base.Render(renderer, time); if (velocity == remVelocity) return; frictionMultiplier = 1.0f - FrictionFactorPerSecond * 0.5f; velocity *= frictionMultiplier; }
private void RegisterInputCommands(InputCommands inputCommands, Time time) { inputCommands.Add(Key.CursorLeft, State.Pressed, () => xPosition -= PaddleMovementSpeed * time.CurrentDelta); inputCommands.Add(Key.CursorRight, State.Pressed, () => xPosition += PaddleMovementSpeed * time.CurrentDelta); inputCommands.Add(MouseButton.Left, State.Pressed, mouse => xPosition += mouse.Position.X - Position.X); inputCommands.Add(State.Pressed, touch => xPosition += touch.GetPosition(0).X - Position.X); inputCommands.Add(GamePadButton.Left, State.Pressed, () => xPosition -= PaddleMovementSpeed * time.CurrentDelta); inputCommands.Add(GamePadButton.Right, State.Pressed, () => xPosition += PaddleMovementSpeed * time.CurrentDelta); }
protected override void Render(Renderer renderer, Time time) { Color = Color.GetRandomBrightColor(); base.Render(renderer, time); }
protected override void Render(Renderer renderer, Time time) { renderer.DrawRectangle(Rectangle.One, new Color(0, 0, 0, Color.AlphaValue)); base.Render(renderer, time); }
public Paddle(Content content, InputCommands inputCommands, Time time) : base(content.Load<Image>("Paddle"), Rectangle.FromCenter(Point.Half, Size.Zero)) { RegisterInputCommands(inputCommands, time); }
protected override void Render(Renderer renderer, Time time) { AreEllipsePointsOutOfDate(); DrawInnerEllipse(renderer); DrawBorderEllipse(renderer); }
protected override void Render(Renderer renderer, Time time) { HasBeenRendered = true; }
protected override void Render(Renderer renderer, Time time) { if (isOnPaddle) UpdateOnPaddle(); else UpdateInFlight(time.CurrentDelta); float aspect = renderer.Screen.ToPixelSpace(Size).AspectRatio; DrawArea = Rectangle.FromCenter(Position, new Size(Height / aspect, Height)); base.Render(renderer, time); }
protected override void Render(Renderer renderer, Time time) { renderer.DrawRectangle(DrawArea, Color); }
public void Settle(Time time, float fallSpeed) { settling += MathExtensions.Min(fallSpeed * time.CurrentDelta, 1.0f); if (settling >= SettleTime && Affix != null) Affix(); }
public void Run(Time time, float fallSpeed) { Top += MathExtensions.Min(fallSpeed * time.CurrentDelta, 1.0f); }
protected override void Render(Renderer renderer, Time time) { borders = renderer.Screen.Viewport; if (isOnPaddle) UpdateOnPaddle(); else UpdateInFlight(time.CurrentDelta); DrawArea = Rectangle.FromCenter(Position, new Size(Height)); base.Render(renderer, time); }
protected override void Render(Renderer renderer, Time time) { foreach (Brick brick in Bricks) brick.Render(renderer); }
protected override void Render(Renderer renderer, Time time) { ShowDollars(renderer.Screen.TopLeft + new Point(0.1f, 0.042f), CurrentMoney); ShowKills(renderer.Screen.Viewport.TopRight + new Point(-0.09f, 0.042f), CurrentKills); }