@image.rect_x = x
@image.rect_y = y
@image.rect_width = width
@image.rect_height = height
@image.set_rect(x, y, width, height)
@cropped_image = TexPlay.create_image $window, 32, 32
@cropped_image.splice @original_image, 16, 16
@original_image.insert(image, x, y)
@cropped_image.splice(@original_image, x, y)
@cropped_image.splice(@original_image, x, y, :alpha_blend => true)
require 'gosu'
require 'texplay'
class Window < Gosu::Window
def initialize
super(640, 480, false)
# Try this code
@original_image = TexPlay.create_image(self, 32, 32)
@original_image.rect(0, 0, 5, 5, :color => :red) # later: Comment this line.
@original_image.insert(Gosu::Image.new(self, 'image.png'), 6, 0)
@cropped_image = TexPlay.create_image(self, 100, 100)
@cropped_image.splice(@original_image, 0, 0)
end
def draw
@cropped_image.draw(0, 0, 0)
end
end
Window.new.show
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill