Basic standard graphics
Adam D. Ruppe
destructionator at gmail.com
Fri Nov 12 15:36:33 PST 2010
bearophile wrote:
> It's cute, it reminds me the recent JavaScript code you may
> find around on the web that uses the canvas.
Yes, partially. I originally wrote that little class in
C++ to simplify the creation of little old console style
games. The D1 version simplified the C++ quite a lot and was
the first serious project I did in D.
The thing I like most is the frame.run method that is automatically
called on a timer. Saves so much boilerplate from the old method;
made me feel like I was coding for DOS again!
> Powerful techniques indeed
I've really been liking main() mixins recently. My CGI code
includes a mixin GenericMain() which gives you a function that
automatically wraps your function in an exception handler that
outputs HTTP 500 responses and lets you take the CGI class
as an argument, so you can do a cgimain(Cgi cgi) instead of
main(string[] args).
Maybe a variety of these "alternative main" implementations might
be a cool addition to the standard library, though I'm not sure
how much help it would actually be outside something like CGI
where there's several lines of boring boilerplate to convert to
a better error output.
> I've seen you have just added your D implementation on the
> RosettaCode site, I may tweak it a bit, if you don't mind.
Of course, have fun!
More information about the Digitalmars-d
mailing list