lib/rubygoo/adapters/rubygame_render_adapter.rb in rubygoo-0.0.7 vs lib/rubygoo/adapters/rubygame_render_adapter.rb in rubygoo-0.0.8

- old
+ new

@@ -8,10 +8,15 @@ def draw_box(x1,y1,x2,y2,color) @screen.draw_box [x1,y1], [x2,y2], convert_color(color) end + def draw_line(x1,y1,x2,y2,color) + c = convert_color(color) + @screen.draw_line_a [x1, y1], [x2, y2], c + end + def draw_circle(cx,cy,radius,color) @screen.draw_circle_a [cx,cy],radius,convert_color(color) end def draw_circle_filled(cx,cy,radius,color) @@ -34,11 +39,25 @@ def finish_drawing() @screen.flip end - def draw_image(img, x, y, color=nil) - img.blit @screen, [x,y] + def draw_image(img, to_x, to_y, color=nil) + img.blit @screen, [to_x,to_y] + end + + def draw_partial_image(img, to_x, to_y, + from_x=nil,from_y=nil,from_w=nil,from_h=nil, color=nil) + if from_x + if from_w + from = [from_x,from_y,from_w,from_h] + else + from = [from_x,from_y] + end + img.blit @screen, [to_x,to_y], from + else + img.blit @screen, [to_x,to_y] + end end def size_text(text, font_file, font_size) @font_cache ||= {} @font_cache[font_file] ||= {}