protected override void OnRenderFrame(FrameEventArgs e) { GL.Clear(ClearBufferMask.ColorBufferBit); shapeRenderer.Begin(); //Create matrix transforms based on the body's rotation and position Vector2 ballPosition = ball.Position * unitToPixel; shapeRenderer.SetTransform( Matrix4.CreateRotationZ(ball.Rotation) * Matrix4.CreateTranslation(ballPosition.X, ballPosition.Y, 0f)); shapeRenderer.DrawShape(rocketShape, Color4.Black); shapeRenderer.ClearTransform(); shapeRenderer.DrawRect(new Vector2(0f, 425f), new Vector2(800f, 25f), Color4.Red); foreach (Body box in boxes) { Vector2 boxPos = (box.Position * unitToPixel) - new Vector2(25f); shapeRenderer.SetTransform( Matrix4.CreateTranslation(-boxPos.X - 25f, -boxPos.Y - 25f, 0f) * Matrix4.CreateRotationZ(box.Rotation) * Matrix4.CreateTranslation(boxPos.X + 25f, boxPos.Y + 25f, 0f)); shapeRenderer.DrawRect(boxPos, new Vector2(50f), Color4.Brown); } shapeRenderer.End(); SwapBuffers(); }
public override void Draw(ShapeRenderer renderer) { renderer.DrawRect(displayArea, Color4.White); }
public override void Draw(ShapeRenderer renderer) { Color4 drawColor = TargetGate.MoveGate ? Color4.MediumPurple : Color4.Orange; renderer.DrawRect(DisplayArea, drawColor); }