getting_started.rdoc

Path: doc/getting_started.rdoc
Last Update: 2009-10-24 15:52:57 -0500

Getting Started with Rubygame

This guide is also available on the Rubygame wiki:

About Rubygame

Rubygame is a cross-platform game-development library for Ruby, inspired by Pygame. Rubygame strives to empower game developers by providing them with powerful and flexible mid-to-high level tools. Instead of worrying about low-level technical details, you can focus your energy on more interesting things (like making a fun game).

Installing Rubygame

Installation guides for Mac and Windows are available in the ‘doc’ directory:

Mac:doc/macosx_install.rdoc
Windows:doc/windows_install.rdoc

You can also find installation instructions for many operating systems online at the Rubygame wiki:

Guides and tutorials

The Rubygame wiki has a list of guides and tutorials to help you get started using Rubygame:

Suggested order of reading

To get acquainted with Rubygame, we recommend exploring the available classes and modules in this order.

First, take a look at the most fundamental classes:

Rubygame::Surface:An image canvas that you can load from an image file, draw shapes on and “blit” (copy) to other Surfaces (or the Screen).
Rubygame::Screen:A special Surface that is displayed to the user. Everything drawn on the Screen appears in the application window on the user’s desktop.
Rubygame::Rect:A rectangular area, used for choosing what parts of a Surface to copy from or to, among other uses.

As a next step, read about the EventQueue, EventHandler, and the user input event classes. These allow you to handle keyboard, mouse, and joystick input from the user, among other things. By creating your own event classes, these systems can also be used to represent things occuring within your game, such as the player losing a life or the level being completed.

Rubygame::EventQueue:A special Array that caches events to be handled later.
Rubygame::EventHandler:A flexible hook-based system for performing actions when certain types of events occur.
Rubygame::Events:A module containing all the built-in event classes in Rubygame.

Finally, you may be interested in these features:

Rubygame::Sprites:A simple and flexible game object framework.
Rubygame::Sound:Play sound effects to make your game more lively.
Rubygame::Music:Play music to enhance your game’s mood.
Rubygame::Clock:Monitor and control framerate to lower CPU use.
Rubygame::TTF:Render text with TrueType fonts.
Rubygame::SFont:Render text with bitmap-based fonts.
Rubygame::GL:Enable OpenGL 2D & 3D graphics.

There are several sample applications in the ‘samples’ directory packaged with Rubygame which can also help you get started.

[Validate]