From 6a9209d5cb69359052955a23c92620bddd62392d Mon Sep 17 00:00:00 2001 From: Kaustubh Maske Patil <37668193+nikochiko@users.noreply.github.com> Date: Wed, 17 Jan 2024 03:22:45 +0530 Subject: [PATCH] Add example with rectangular canvas (for testing) (#87) A circle in a rectangular canvas should not become an ellipse. --- examples/dune | 9 +++++++-- examples/rectangle_canvas.ml | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 examples/rectangle_canvas.ml diff --git a/examples/dune b/examples/dune index b828d8b..4029bf3 100644 --- a/examples/dune +++ b/examples/dune @@ -78,12 +78,17 @@ (modules rectangle) (libraries joy)) +(executable + (name rectangle_canvas) + (modules rectangle_canvas) + (libraries joy)) + (executable (name star) (modules star) (libraries joy)) - -(executable + +(executable (name repeat) (modules repeat) (libraries joy)) diff --git a/examples/rectangle_canvas.ml b/examples/rectangle_canvas.ml new file mode 100644 index 0000000..3fedbf5 --- /dev/null +++ b/examples/rectangle_canvas.ml @@ -0,0 +1,9 @@ +open Joy + +let () = + init ~size:(500., 300.) (); + background (1., 1., 1., 1.); + let c = circle 50. in + set_color (0., 0., 0.); + show [ c ]; + write ~filename:"rectangular_canvas.png" ()