Module: Salamander

Defined in:
lib/salamander.rb,
lib/salamander/actor.rb,
lib/salamander/canvas.rb,
lib/salamander/support.rb,
lib/salamander/version.rb,
lib/salamander/constants.rb

Defined Under Namespace

Modules: Drawing Classes: Actor, Canvas

Constant Summary collapse

VERSION =
"0.1.3"
DIRECTIONS =
{
  :right => 90,
  :left => -90,
  :around => 180,
}
COMPASS =
{
  :east => 0,
  :northeast => 315,
  :north => 270,
  :northwest => 225,
  :west => 180,
  :southwest => 135,
  :south => 90,
  :southeast => 45,
}
COLORS =
{
  :red => "#FF0000",
  :green => "#00FF00",
  :blue => "#0000FF",
  :yellow => "#FFF00",
  :magenta => "#FF00FF",
  :cyan => "#00FFFF",
}

Class Method Summary collapse

Class Method Details

.setup(width, height) ⇒ Object

Initialize SDL and create a window

Do not call more than once



12
13
14
15
16
17
18
19
# File 'lib/salamander.rb', line 12

def self.setup (width, height)
  SDL.Init(SDL::INIT_VIDEO)
  at_exit { SDL.Quit }
  
  info = SDL.GetVideoInfo
  flags = (info.hw_available) ? SDL::HWSURFACE : SDL::SWSURFACE
  Canvas.new(SDL.SetVideoMode(width, height, info.vfmt.BitsPerPixel, flags))
end