diff --git a/lib/dxruby_sdl/image.rb b/lib/dxruby_sdl/image.rb index 8f65bff..cc9f1b4 100644 --- a/lib/dxruby_sdl/image.rb +++ b/lib/dxruby_sdl/image.rb @@ -39,6 +39,12 @@ def initialize(width, height, color = [0, 0, 0, 0]) @_surface = SDL::Surface.new(SDL::SWSURFACE, width, height, Window.send(:screen)) @_surface.fill_rect(0, 0, width, height, @color) + + # TODO: a値が0の時にしか対応していない。 + # 1から254の値に対応すること + if color[3] == 0 + set_color_key(@color[0..2]) + end end def width @@ -51,7 +57,6 @@ def height def set_color_key(color) @_surface.set_color_key(SDL::SRCCOLORKEY | SDL::RLEACCEL, color) - @_surface = @_surface.display_format_alpha end def compare(x, y, color)