Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/dxruby_sdl/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down