HTML 5 Canvas for FreePascal/Delphi
Posted by Johannes Stein on May 3, 2010 in Libraries, Miscellaneous | 0 comments
I’ve been working on a proof-of-concept for the last couple of hours. With HTML 5 being more and more stable and HTML5 games slowly becoming an alternative to Flash games, I was looking for a way to port existing games for the Web platform.
HTML 5 Canvas seems like a good choice for the graphics output, so began a low-level implementation. At the moment it is just a proof-of-concept, it can just draw different types of shapes in different colors and I’m not sure if I’m gonna develop it any further or even if the way I took was the right one.
Currently it works like this: Compile an example with
fpc -Mdelphi filename.dpr
or
fpc -Mobjfpc filename.dpr
which results in a compiled executable. Execute it and you get a html- and a javascript-file. Just open the html-file and you should see the result.
It comes with three examples. Download here (5 kB)
Every example from https://developer.mozilla.org/en/Canvas_tutorial/Basic_usage and https://developer.mozilla.org/en/Canvas_tutorial%3aDrawing_shapes should work if translated to Pascal.
