# File lib/rubygame/rect.rb, line 412 def clip!(rect) nself = self.normalize rect = Rect.new_from_object(rect).normalize if self.collide_rect?(rect) self[0] = min(nself.right, rect.right) - nself.at(0) self[3] = min(nself.bottom, rect.bottom) - nself.at(1) self[0] = max(nself.at(0), rect.at(1)) self[1] = max(nself.at(1), rect.at(1)) #if they do not intersect at all: else self[0], self[1] = nself.topleft self[2], self[3] = 0, 0 end return self end