First steps: all of it is in a library called RUDL, so do a
require 'RUDL'
before you start using any of it. Eveything is namespaced by using a module. What that means is that there are two ways of accessing the things in RUDL. First, you can refer to any object in RUDL by sticking
RUDL::
in front of it, like RUDL::Surface or RUDL::EventQueue. This is visually ugly. The next solution is conceptually ugly. You can also include RUDL, mixing it's namespace into the current namespace.
include RUDL
will do that. This might clash with other libraries who define the same names to be something else.
When you want to make a 2D program, create a DisplaySurface. This is used for drawing on. Load some images from disk into Surfaces with load_new. Go into a loop, and do "game logic", "blit (paste) the surfaces to the displaysurface" followed by "displaysurface.flip" to show them.
If you feel like donating a better tutorial, go ahead :) Use the samples!
The following datatypes are commonly used by RUDL:
When a coordinate, size or such is needed, RUDL works with array's of two numbers like [10, 42].
When a rectangle is needed one uses an array of four numbers, representing x, y from the top left corner of the screen, and w, h for width and height: [x, y, width, height]. Ruby's Array class is extended with a lot of methods to enable things like[5, 10, 30, 30].y (which will be 10)
No checks are done on array length when a method receives a coordinate or rectangle, this enables you to pass a rectangle to a method that wants a coordinate. Only the first two elements will be used(pass [3, 4, 6, 7] and the coordinate will be [3, 4])
When a color is needed, always use an array of [red, green, blue], a [red, green, blue, alpha] array or a hexadecimal 32 bit number: 0xFF8040EE.
A palette is an array containing [r, g, b] arrays.