Class: Gosu::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/devil/gosu.rb

Class Method Summary collapse

Class Method Details

.new(window, file, *args, &block) ⇒ Object

monkey patching to support multiple image formats. This method is only available if require ‘devil/gosu’ is used



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/devil/gosu.rb', line 56

def new(window, file, *args, &block)
    if file.respond_to?(:to_blob) || file =~ /\.(bmp|png)$/
        original_new_redux(window, file, *args, &block)
    else
        img = Devil.load(file).flip
        begin
            gosu_img = original_new_redux(window, img, *args, &block)
        ensure
            img.free
        end

        gosu_img
    end
end

.original_new_reduxObject



52
# File 'lib/devil/gosu.rb', line 52

alias_method :original_new_redux, :new