Module: Tea

Defined in:
lib/tea.rb,
lib/tea/c_font.rb,
lib/tea/c_error.rb,
lib/tea/c_sound.rb,
lib/tea/m_color.rb,
lib/tea/m_event.rb,
lib/tea/c_bitmap.rb,
lib/tea/o_screen.rb,
lib/tea/m_event_app.rb,
lib/tea/mix_blitting.rb,
lib/tea/mix_clipping.rb,
lib/tea/mix_grabbing.rb,
lib/tea/m_event_mouse.rb,
lib/tea/mix_primitive.rb,
lib/tea/m_event_dispatch.rb,
lib/tea/m_event_keyboard.rb,
lib/tea/mix_image_saving.rb

Overview

The Tea module acts as a namespace for all Tea-related objects and methods.

Defined Under Namespace

Modules: App, Blitting, Clipping, Color, Event, Grabbing, ImageSaving, Kbd, Mouse, Primitive Classes: Bitmap, Error, Font, Screen, Sound

Constant Summary collapse

RUBY_1_9 =
rv_match && rv_match[1].to_i >= 1 && rv_match[2].to_i >= 9

Class Method Summary collapse

Class Method Details

.initObject

Initialise Tea. This needs to be called before using any of Tea’s objects or methods.

May throw Tea::Error if initialisation fails.



21
22
23
24
25
26
27
28
29
# File 'lib/tea.rb', line 21

def Tea.init
  SDL.init(SDL::INIT_VIDEO | SDL::INIT_AUDIO)

  # Get typed characters from keys when pressed.
  SDL::Event.enable_unicode
  SDL::Mixer.open 44100, SDL::Mixer::DEFAULT_FORMAT, SDL::Mixer::DEFAULT_CHANNELS, 1024
rescue SDL::Error => e
  raise Tea::Error, e.message, e.backtrace
end