本帖最后由 判约之轮 于 2012-4-5 12:49 编辑
feizhaodan 发表于 2012-4-4 17:35
1,sprite类没有contents这个属性。因该是bitmap
2,大概方法,就是将windowskin的光标部分取出到单独Bitmap ...
果然····contents不是自定义函数而是内置函数····
抱歉刚才去点像素画没看到·····
于是我一会去试试嗯,多谢啦~
闪过来写一下最后的解决办法:
#-------------------------------------------------------------------------- # ● 获取项目的绘制矩形 #-------------------------------------------------------------------------- def item_rect(index) if $menu_open == false rect = Rect.new rect.width = item_width rect.height = item_height rect.x = index % col_max * (item_width + spacing) rect.y = index / col_max * item_height rect else if $rect_if == true $rectm.dispose end $rectm = Sprite.new $rectm.bitmap = Bitmap.new("Graphics/Menu/menurect1.png") temp1 = index % col_max * (item_width) temp2 = index / col_max * item_height rect = Rect.new(temp1, temp2, $rectm.bitmap.width, $rectm.bitmap.height) #self.contents.blt(temp1, temp2, rectm.bitmap, rect) $rectm.x = temp1 + 2 $rectm.y = temp2 + 118 $rect_if = true rect.x = temp1 rect.y = temp2 rect end end
#--------------------------------------------------------------------------
# ● 获取项目的绘制矩形
#--------------------------------------------------------------------------
def item_rect(index)
if $menu_open == false
rect = Rect.new
rect.width = item_width
rect.height = item_height
rect.x = index % col_max * (item_width + spacing)
rect.y = index / col_max * item_height
rect
else
if $rect_if == true
$rectm.dispose
end
$rectm = Sprite.new
$rectm.bitmap = Bitmap.new("Graphics/Menu/menurect1.png")
temp1 = index % col_max * (item_width)
temp2 = index / col_max * item_height
rect = Rect.new(temp1, temp2, $rectm.bitmap.width, $rectm.bitmap.height)
#self.contents.blt(temp1, temp2, rectm.bitmap, rect)
$rectm.x = temp1 + 2
$rectm.y = temp2 + 118
$rect_if = true
rect.x = temp1
rect.y = temp2
rect
end
end
最终也没能完全改好,只能变通一下,通过精灵转矩形解决了~ |