Phillip Trelford's Array

POKE 36879,255

Introducing FunSharp

FunSharp is a new cross-platform open source graphics library, based on Small Basic’s library, with a typed API crafted for the sharp languages, F# and C#.

Drawing graphics is quick and easy:

GraphicsWindow.FillEllipse(10,10,300,300)

And when you ask FunSharp to draw graphics it will just go and open a window to view it for you:

Purple_Circle

FunSharp provides similar functionality to Python’s PyGame, used for developing games, and Processing used for visual art.

You can call FunSharp immediately from the F# REPL or build full-blown applications using F# and C#.

It’s an ideal library for beginners or anyone who just wants  to get stuff on the screen quickly.

With this in mind FunSharp works seamlessly on Raspberry Pi, Linux and Windows.

Getting Started

If you haven’t already, you’ll need to install F# on your machine, follow these instructions:

  • Linux (for Raspbian follow the Debian instructions)
  • Windows (install Xamarin Studio or Visual Studio)

Get the FunSharp source from GitHub using Clone or Download Zip, then load the FunSharp solution into MonoDevelop or Visual Studio and starting playing with the samples.

Notes:

  • FunSharp is built on Mono’s cross platform graphics libraries Xwt and Gtk# libraries which must be referenced.
  • currently apps must run in 32-bit mode.

Turtles

FunSharp has a Turtle module, which can be used to make fun shapes:

Turtle.X <- 150.
Turtle.Y <- 150.
for i in 0..5..200 do
   Turtle.Move(i)
   Turtle.Turn(90)

Renders:

Turtle_Example

Games

FunSharp can be used to make games quickly and easily. I’ve ported several games written for Small Basic requiring only minor modifications:

Asteroids

Have fun!