Project1
标题:
立体版文字
[打印本页]
作者:
304475881
时间:
2007-12-27 03:04
标题:
立体版文字
如题:
首先把一个描边加进去。
class Bitmap
unless $OK
alias NKX_draw_text draw_text unless method_defined? :NKX_draw_text
def draw_text(p1, p2, p3 = 0, p4 = 3, p5 = nil, p6 = 0, p7 = 3, p8 = nil)
case p1
when Numeric
x = p1
y = p2
width = p3
height = p4
text = p5
align = p6
shadow_direction = p7
shadow_color = p8
if shadow_color.nil?
shadow_color = Color.new(0, 0, 0, self.font.color.alpha * 0.67)
end
when Rect
x = p1.x
y = p1.y
width = p1.width
height = p1.height
text = p2
align = p3
shadow_direction = p4
shadow_color = p5
if shadow_color.nil?
shadow_color = Color.new(0, 0, 0, self.font.color.alpha * 0.67)
end
end
color_temp = self.font.color.clone
self.font.color = Color.new(255, 255, 255, 255)
NKX_draw_text(x + 1,y + 1,width, height, text, align)
NKX_draw_text(x + 1,y - 1,width, height, text, align)
NKX_draw_text(x - 1,y - 1,width, height, text, align)
NKX_draw_text(x - 1,y + 1,width, height, text, align)
self.font.color = color_temp
$OK = true
NKX_draw_text(x, y, width, height, text, align)
end
end
end
第二步把一个阴影加进去。
class Bitmap
unless $OK
alias sailcat_draw_text draw_text
def draw_text(p1, p2, p3 = 0, p4 = 3, p5 = nil, p6 = 0, p7 = 3, p8 = nil)
case p1
when Numeric
x = p1
y = p2
width = p3
height = p4
text = p5
align = p6
shadow_direction = p7
shadow_color = p8
if shadow_color.nil?
shadow_color = Color.new(0, 0, 0, self.font.color.alpha * 0.67)
end
when Rect
x = p1.x
y = p1.y
width = p1.width
height = p1.height
text = p2
align = p3
shadow_direction = p4
shadow_color = p5
if shadow_color.nil?
shadow_color = Color.new(0, 0, 0, self.font.color.alpha * 0.67)
end
end
color_temp = self.font.color.clone
if shadow_direction != 0
self.font.color = shadow_color
case shadow_direction
when 1
sailcat_draw_text(x-1, y+1, width, height, text, align)
when 3
sailcat_draw_text(x+1, y+1, width, height, text, align)
when 7
sailcat_draw_text(x-1, y-1, width, height, text, align)
when 9
sailcat_draw_text(x+1, y-1, width, height, text, align)
end
self.font.color = color_temp
end
$OK = true
sailcat_draw_text(x, y, width, height, text, align)
end
end
end
这样就做好了。
作者:
304475881
时间:
2007-12-27 03:04
标题:
立体版文字
如题:
首先把一个描边加进去。
class Bitmap
unless $OK
alias NKX_draw_text draw_text unless method_defined? :NKX_draw_text
def draw_text(p1, p2, p3 = 0, p4 = 3, p5 = nil, p6 = 0, p7 = 3, p8 = nil)
case p1
when Numeric
x = p1
y = p2
width = p3
height = p4
text = p5
align = p6
shadow_direction = p7
shadow_color = p8
if shadow_color.nil?
shadow_color = Color.new(0, 0, 0, self.font.color.alpha * 0.67)
end
when Rect
x = p1.x
y = p1.y
width = p1.width
height = p1.height
text = p2
align = p3
shadow_direction = p4
shadow_color = p5
if shadow_color.nil?
shadow_color = Color.new(0, 0, 0, self.font.color.alpha * 0.67)
end
end
color_temp = self.font.color.clone
self.font.color = Color.new(255, 255, 255, 255)
NKX_draw_text(x + 1,y + 1,width, height, text, align)
NKX_draw_text(x + 1,y - 1,width, height, text, align)
NKX_draw_text(x - 1,y - 1,width, height, text, align)
NKX_draw_text(x - 1,y + 1,width, height, text, align)
self.font.color = color_temp
$OK = true
NKX_draw_text(x, y, width, height, text, align)
end
end
end
第二步把一个阴影加进去。
class Bitmap
unless $OK
alias sailcat_draw_text draw_text
def draw_text(p1, p2, p3 = 0, p4 = 3, p5 = nil, p6 = 0, p7 = 3, p8 = nil)
case p1
when Numeric
x = p1
y = p2
width = p3
height = p4
text = p5
align = p6
shadow_direction = p7
shadow_color = p8
if shadow_color.nil?
shadow_color = Color.new(0, 0, 0, self.font.color.alpha * 0.67)
end
when Rect
x = p1.x
y = p1.y
width = p1.width
height = p1.height
text = p2
align = p3
shadow_direction = p4
shadow_color = p5
if shadow_color.nil?
shadow_color = Color.new(0, 0, 0, self.font.color.alpha * 0.67)
end
end
color_temp = self.font.color.clone
if shadow_direction != 0
self.font.color = shadow_color
case shadow_direction
when 1
sailcat_draw_text(x-1, y+1, width, height, text, align)
when 3
sailcat_draw_text(x+1, y+1, width, height, text, align)
when 7
sailcat_draw_text(x-1, y-1, width, height, text, align)
when 9
sailcat_draw_text(x+1, y-1, width, height, text, align)
end
self.font.color = color_temp
end
$OK = true
sailcat_draw_text(x, y, width, height, text, align)
end
end
end
这样就做好了。
作者:
ベスト。
时间:
2007-12-27 03:05
提示:
作者被禁止或删除 内容自动屏蔽
作者:
enghao_lim
时间:
2007-12-27 03:09
看到熟悉人的名字出现在脚本里。
sailcat
作者:
Eclair
时间:
2007-12-27 03:16
提示:
作者被禁止或删除 内容自动屏蔽
作者:
朝花夕拾
时间:
2007-12-29 05:32
提示:
作者被禁止或删除 内容自动屏蔽
作者:
精灵使者
时间:
2007-12-29 05:58
我现在还以sailcat大的阴影脚本作为我的文字核心脚本呢。话说,用好了会有很多非常漂亮的效果地说。
作者:
火鸡三毛老大
时间:
2008-1-4 20:46
支持一下 {/dy} ...
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1