#==============================================================================
# – SG::Cursor_Rect
#==============================================================================
# Edited by Draycos Goldaryn for Star on HBGames.org
#==============================================================================
class SG::Cursor_Rect
#--------------------------------------------------------------------------
# — instances settings
#--------------------------------------------------------------------------
attr_reader :height, :width, :skin, :margin
#--------------------------------------------------------------------------
# — initialize
#--------------------------------------------------------------------------
def initialize(viewport)
super(viewport)
@width = 0
@height = 0
@skin = nil
@margin = 0
@rect = Rect.new(129, 64, 30, 32) #middle of the cursor
@rect1 = Rect.new(128, 64, 1, 32) #ends of the cursor
end
#--------------------------------------------------------------------------
# — draw_rect
#--------------------------------------------------------------------------
def draw_rect
return if @skin == nil
#tile the rect across the selection
if @width > 0 and @height > 0
#set the width and height
self.bitmap = Bitmap.new(@width, @height)
#find how many times it'll tile
max_x = self.bitmap.width / @rect.width
max_y = self.bitmap.height / @rect.height
#tile it
for x in 0..max_x
for y in 0..max_y
self.bitmap.blt(0, y * @rect.height,
@skin, @rect1)
self.bitmap.blt(x * @rect.width, y * @rect.height,
@skin, @rect)
self.bitmap.blt(@width - 1, y * @rect.height,
@skin, @rect1)
end
end
end
end
end
#replace the default Window class now.
class Window < SG::Window ; end