Processing FS is an attempt to take the ideals from the wonderful
processing library and port them to a .net and F# environment. I am making no attempt to completely port the library, but I hope to preserve the feel that processing gives in the port to F#.
Although this project is written in f# primarily, I am using the Writeable Bitmap Extensions library (also on codeplex) which is in c# and I will use any .net library if it makes sense in the library.
type Sample () =
let mutable currentX = 0
let mutable currentY = 0
override this.Setup () = this.Background 255
this.Size 600 600
override this.Draw () =
currentX <- currentX + ((this.MouseX - currentX) / 10)
currentY <- currentY + ((this.MouseY - currentY) / 10)
this.Ellipse currentX currentY 50 50
override this.MouseLeft () =
let pApp = new Sample()
As you can see the code is very simple and I would like to think, quite elegant. The overridden methods setup, draw and mouseleft each are called when needed. Setup is called after the bitmap and everything is finished, draw is called 60 times a second to
update the bitmap and any other objects, and mouseleft is called immediately before the draw if the left mouse button has been clicked.
Not only is this code nice when used with F#, the equivalent code looks just as nice, if not better, in C#:
static void Main(string args)
var pApp = new Sample();
private int currentX;
private int currentY;
public override void Setup()
public override void Draw()
currentX = currentX + ((MouseX - currentX)/10);
currentY = currentY + ((MouseY - currentY)/10);
Ellipse(currentX, currentY, 50, 50);
public override void MouseLeft()
I hope to create a programming environment that is as clean, and as satisfying to work with as the processing library. If you find something that is not to your liking, or that you would like to see in the system, post a discussion, or fork the code and
add it yourself, I am happy to accept submissions for new code.