赞 | 12 |
VIP | 107 |
好人卡 | 6 |
积分 | 4 |
经验 | 31122 |
最后登录 | 2024-6-29 |
在线时间 | 1606 小时 |
Lv2.观梦者 傻♂逼
- 梦石
- 0
- 星屑
- 374
- 在线时间
- 1606 小时
- 注册时间
- 2007-3-13
- 帖子
- 6562
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
class Inputbox
def initialize(x,y="rect",w="rect",h="rect")
if h == "rect"
@rect = x
@rect2 = Rect.new(@rect.x+1,@rect.y+1,@rect.width-1,@rect.height-1)
else
@rect = Rect.new(x,y,w,h)
@rect2 = Rect.new(x+1,y+1,w-1,h-1)
end
@txtbox = TextBox.new(@rect.width,@rect.height)
@back = Sprite.new
@back.x = @rect.x
@back.y = @rect.y
@back.z = 32460
@back.bitmap = Bitmap.new(@rect.width,@rect.height)
@back.bitmap.fill_rect(@rect,Color.new(0,0,0))
@in = Sprite.new
@in.x = @rect.y
@in.y = @rect.y+1
@in.z = 32460
@in.bitmap = Bitmap.new(@rect2.width,@rect2.height)
@in.bitmap.fill_rect(@rect2,Color.new(255,255,255))
@text_show = Sprite.new
@text_show.x = @rect.y+1
@text_show.y = @rect.x+1
@text_show.z = 32460
@text_show.bitmap = Bitmap.new(@rect2.width,@rect2.height)
@ot = nil
@active = true
end
def active=(value)
@active = value
end
def active
return @active
end
def text=(text1)
@txtbox.set_txt(text1)
end
def text
return @txtbox.txt
end
def update
hitTest
if @active
@txtbox.update
end
@t = text
if @t != @ot
@text_show.bitmap.clear
@text_show.bitmap.draw_text(@rect2,@t)
end
end
def dispose
@txtbox.dispose
@back.dispose
@in.dispose
@text_show.dispose
end
#--------------------------------------------------------------------------
# Check Mouse over rect?
#--------------------------------------------------------------------------
def mouse_over?(rect)
if $mouse.x > rect.x and $mouse.x < rect.x + rect.width and
$mouse.y > rect.y and $mouse.y < rect.y + rect.height
return true
end
return false
end
def hitTest
if Input.pressed?(Input::Mouse_Left)
if mouse_over?(@rect)
@active = true
else
@active = false
end
end
end
end
为什么Sprite不显示 此贴于 2008-9-13 10:02:44 被版主八云紫提醒,请楼主看到后对本贴做出回应。 本贴由论坛斑竹八云紫结贴,如楼主认为问题未解决,请重新将此贴编辑为“有事请教”,并回帖叙述疑点即可~ ^-^ |
|