Sha256: 8da8177810c2e7fdaf2831f2dc4493c19b0f57f2a08768f26427e8f4d6f2bd09

Contents?: true

Size: 1.87 KB

Versions: 38

Compression:

Stored size: 1.87 KB

Contents

# Extend Numeric with simple angle conversion methods.
class ::Numeric
  def degrees_to_radians
    self * Math::PI / 180.0
  end
  def radians_to_degrees
    self * 180.0 / Math::PI
  end
  def gosu_to_radians
    (self - 90) * Math::PI / 180.0
  end
  def radians_to_gosu
    self * 180.0 / Math::PI + 90
  end
end
    
# Backwards compatibility: import constants into Gosu::Button.
module Gosu::Button
  Gosu.constants.each { |c| const_set(c, Gosu.const_get(c)) }
end

# Backwards compatibility: Window arguments to Sample and Song
class Gosu::Sample
  alias initialize_ initialize
  
  def initialize(*args)
    args.shift if args.first.is_a? Gosu::Window
    initialize_(*args)
  end
end
class Gosu::Song
  alias initialize_ initialize
  
  def initialize(*args)
    args.shift if args.first.is_a? Gosu::Window
    initialize_(*args)
  end
end

# Color constants (SWIG messes up constants somehow)
class Gosu::Color
  class Constant < Gosu::Color
  private
    def alpha=; end
    def red=; end
    def green=; end
    def blue=; end
    def hue=; end
    def saturation=; end
    def value=; end
  end
  
  NONE    = Gosu::Color::Constant.argb(0x00000000)
  BLACK   = Gosu::Color::Constant.argb(0xff000000)
  GRAY    = Gosu::Color::Constant.argb(0xff808080)
  WHITE   = Gosu::Color::Constant.argb(0xffffffff)            
  AQUA    = Gosu::Color::Constant.argb(0xff00ffff)
  RED     = Gosu::Color::Constant.argb(0xffff0000)
  GREEN   = Gosu::Color::Constant.argb(0xff00ff00)
  BLUE    = Gosu::Color::Constant.argb(0xff0000ff)
  YELLOW  = Gosu::Color::Constant.argb(0xffffff00)
  FUCHSIA = Gosu::Color::Constant.argb(0xffff00ff)
  CYAN    = Gosu::Color::Constant.argb(0xff00ffff)
end

# Instance methods for button_id_to_char and char_to_button_id
class Gosu::Window
  def button_id_to_char(id)
    self.class.button_id_to_char(id)
  end
  
  def char_to_button_id(ch)
    self.class.char_to_button_id(ch)
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
gosu-0.7.43-universal-darwin lib/gosu/patches.rb
gosu-0.7.43 lib/gosu/patches.rb
gosu-0.7.43-x86-mingw32 lib/gosu/patches.rb
gosu-0.7.41 lib/gosu/patches.rb
gosu-0.7.41-x86-mingw32 lib/gosu/patches.rb
gosu-0.7.41-universal-darwin lib/gosu/patches.rb
gosu-0.7.40 lib/gosu/patches.rb
gosu-0.7.40-x86-mingw32 lib/gosu/patches.rb
gosu-0.7.40-universal-darwin lib/gosu/patches.rb
gosu-0.7.39 lib/gosu/patches.rb
gosu-0.7.39-x86-mingw32 lib/gosu/patches.rb
gosu-0.7.39-universal-darwin lib/gosu/patches.rb
gosu-0.7.38 lib/gosu/patches.rb
gosu-0.7.38-i386-mingw32 lib/gosu/patches.rb
gosu-0.7.38-universal-darwin lib/gosu/patches.rb
gosu-0.7.37 lib/gosu/patches.rb
gosu-0.7.37-i386-mingw32 lib/gosu/patches.rb
gosu-0.7.37-universal-darwin lib/gosu/patches.rb
gosu-0.7.36.2 lib/gosu/patches.rb
gosu-0.7.36.2-i386-mingw32 lib/gosu/patches.rb