A simple 2D game development library for Ruby.
= Tea
For simpler games from a simpler age.
Tea is a simple 2D game development library for Ruby. It’s designed with these
things in mind:
The aim of Tea is to bring back some of the grass roots game development that
things like QBASIC fostered. By staying unobtrusive and out of the way, Tea
lets you focus on your game or demo, and not the pointy bits that are part of
many game engines and APIs.
== Installing
First, get Ruby (http://www.ruby-lang.org) if you don’t have it already. Ruby
1.9 or later is recommended.
Tea is available as a gem on Gemcutter, so add http://gemcutter.org to your
~/.gemrc and type
gem install tea
== Using Tea
First, require ‘tea’. This allows you to start using the rest of the Tea API.
From there, you have access to all of Tea’s modules, objects and methods.
Below is a simple bouncing circle demo.
require ‘tea’
Tea.init
Tea::Screen.set_mode 640, 480
x, y = 320, 240
dx, dy = rand() * 4 - 2, rand() * 4 - 2
r = 20
loop do
if e = Tea::Event.get
break if e.class == Tea::App::Exit
end
x += dx
y += dy
dx = -dx if x - r < 0 || x + r >= Tea::Screen.w
dy = -dy if y - r < 0 || y + r >= Tea::Screen.h
Tea::Screen.clear
Tea::Screen.circle x, y, r, Tea::Color::MAGENTA
Tea::Screen.update
sleep 0.001
end
== Status
All done.
== More information
Project page:: http://github.com/tung/tea
Wiki:: http://wiki.github.com/tung/tea
== License
Tea is free software: you can redistribute it and/or modify it under the terms
of the GNU Lesser General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version. Tea is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along
with Tea. If not, see (http://www.gnu.org/licenses).
Copyright © 2009 Tung Nguyen.