module R2D::Adapters::Gosu
Public Class Methods
create_window(window)
click to toggle source
# File lib/r2d/adapters/gosu.rb, line 11 def self.create_window(window) @gosu_window = GosuWindow.new(window) end
current_song()
click to toggle source
# File lib/r2d/adapters/gosu.rb, line 26 def self.current_song; ::Gosu::Song.current_song end
get_color(r, g, b, a)
click to toggle source
# File lib/r2d/adapters/gosu.rb, line 22 def self.get_color(r, g, b, a); ::Gosu::Color.argb(a, r, g, b) end
image(path)
click to toggle source
# File lib/r2d/adapters/gosu.rb, line 30 def self.image(path); ::Gosu::Image.new(@gosu_window, path, true) end
key_id(key)
click to toggle source
# File lib/r2d/adapters/gosu.rb, line 37 def self.key_id(key) case key when 'up' id = ::Gosu::KbUp when 'down' id = ::Gosu::KbDown when 'left' id = ::Gosu::KbLeft when 'right' id = ::Gosu::KbRight when 'left_alt' id = ::Gosu::KbLeftAlt when 'right_alt' id = ::Gosu::KbRightAlt when 'left_control' id = ::Gosu::KbLeftControl when 'right_control' id = ::Gosu::KbRightControl when 'left_shift' id = ::Gosu::KbLeftShift when 'right_shift' id = ::Gosu::KbRightShift when 'backspace' id = ::Gosu::KbBackspace when 'delete' id = ::Gosu::KbDelete when 'space' id = ::Gosu::KbSpace when 'tab' id = ::Gosu::KbTab when 'return' id = ::Gosu::KbReturn when 'mouse_left' id = ::Gosu::MsLeft when 'mouse_right' id = ::Gosu::MsRight when ('a'..'z') || ('A'..'Z') || ('0'..'9') id = @gosu_window.char_to_button_id(key) else raise Error, "The key '#{key}' is not valid!" end end
mouse_x()
click to toggle source
# File lib/r2d/adapters/gosu.rb, line 19 def self.mouse_x; @gosu_window.mouse_x end
mouse_y()
click to toggle source
# File lib/r2d/adapters/gosu.rb, line 20 def self.mouse_y; @gosu_window.mouse_y end
show_window()
click to toggle source
# File lib/r2d/adapters/gosu.rb, line 15 def self.show_window @gosu_window.show end
song(path)
click to toggle source
# File lib/r2d/adapters/gosu.rb, line 24 def self.song(path); ::Gosu::Song.new(@gosu_window, path) end
sound(path)
click to toggle source
# File lib/r2d/adapters/gosu.rb, line 28 def self.sound(path); ::Gosu::Sample.new(@gosu_window, path) end
text(h, font)
click to toggle source
# File lib/r2d/adapters/gosu.rb, line 32 def self.text(h, font) if font == 'default' then font = ::Gosu::default_font_name end ::Gosu::Font.new(@gosu_window, font, h) end