I want to use racket to make a game whose graphics would involve a grid where each cell could be filled with one or more sprites on top of each other. Racket has a graphics and gui toolkit in its standard library, which is very nice. But apart from its formal documentation I can't find anything on using the library in practice and more importantly I can't find anything on rendering output of the drawing library in a GUI so that it can actually be interacted with.
Are there any good resources for this (books blog posts, screencasts) or at least a decent open source project I can look at to get a feel for it?
One thing that you can start playing with is the new "planet cute" thing that is included with the recently released 5.2.1. You can then go into the implementation to see how you can plug your own images. From there it should be easier to go on into the generic gui interface.
Alternatively, you can get more serious and use the allegro package to have full-screen games.
I've written a very rough-and-dirty example that might help you get started: see How to make a GUI using Lisp: DrScheme or Common Lisp. The example includes just enough to have a simple timer loop and a key-handler that doesn't do much yet.
What you might want to look at, too, is the racket/draw
library, which includes the standard image primitives you'd expect from a drawing toolkit. The overview shows you how to draw using a drawing context. My example has a function called paint!
that uses a window on-screen as the drawing canvas.
As for blogs, I haven't seen too much yet. I'll try to keep my eyes peeled and update this answer when I find things. There are hints that Realm of Racket will talk about game programming, but I have no knowledge whether or not it will be good yet. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With