#===============================================================================
# Graphics_显示消息(任何时候)
# 调用:pst(内容,是否不消失?,初始化透明度)
# It can write down:(t1,t2,t3.....) and not erron as print.
# ----By End66rpg in 2012,1.
#===============================================================================
module Graphics
# 生成Sprite对像
@Tsprite = Sprite.new
@Tsprite.bitmap = Bitmap.new(640,32)
@Tsprite.z = 9999999 + 1
@Tsprite.opacity = 0
@waitframe = 0
Update = method("update")
def self.update(*arg)
Update.call(*arg)
unless @noclear == true
if @waitframe != 0
@waitframe -= 1
else
if @Tsprite != nil and @Tsprite.opacity > 0
@Tsprite.opacity -= 5
end
end
end
end
def self.SetNewText(text,noclear,op)
if text.size > 100 and !text.is_a?(Array)
if [text] == text.split("\n")
text = text.unpack('100a100a100a')
else
text = text.split("\n")
end
else
text = text.to_a
end
@Tsprite.bitmap = Bitmap.new(640,32+text.size*32)
@Tsprite.opacity = op.to_i
@Tsprite.bitmap.clear
@Tsprite.bitmap.fill_rect(0,0,640,text.size*32, Color.new(255,255,255,126))
@Tsprite.bitmap.font.color = Color.new(0,0,0)
for t in 0..text.size-1
@Tsprite.bitmap.draw_text(0,t*32,640,32, text[t].to_s)
end @noclear = noclear
@waitframe = (text.size)*20
@waitframe += 40 if text.size >= 2
end
def self.noclear=(xx)
@noclear = xx
end
end
module Kernel
#Print Super Text !!
def pst(*arg)#(text,noclear = false,op=255)
if [*arg][1].is_a?(String)
Graphics.SetNewText([*arg],false,255)
return
end
a = ([*arg][1]==nil ? false : [*arg][1])
b = ([*arg][2]==nil ? 255 : [*arg][2])
Graphics.SetNewText([*arg][0],a,b)
end
end
#===============================================================================
# Happy NewYear!
#===============================================================================