I found a script on a Japanese website that puts a shadow around certain battle text text to make it more readable. The problem is, I don't know how to use it. Here's a screenshot of what it does.
http://f44.aaa.livedoor.jp/~ytomy/tkool ... lter01.jpg[/IMG]
And here's the script.
http://f44.aaa.livedoor.jp/~ytomy/tkool ... lter01.jpg[/IMG]
And here's the script.
Code:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/  ◆ç¸å–り・影文å—æç”» ï¼ KGC_FrameShadowTextâ—†
#_/----------------------------------------------------------------------------
#_/ draw_text を強化ã—ã€ç¸å–りや影文å—ã®æç”»æ©Ÿèƒ½ã‚’è¿½åŠ ã—ã¾ã™ã€‚
#_/ Provides functions to draw texts which framed or dropped shadow.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
=begin
â”â”â”â”â” æ載メソッド - Methods â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”
┠─── Class - Bitmap ────────────────────────────
┃ draw_frame_text(x, y, width, height, string[, align, frame_color])
┃ draw_frame_text(rect, string[, align, frame_color])
┃ x, y : æ画先座標 [Integer]
┃ Destination.
┃ width, height : æ画サイズ [Integer]
┃ Size.
┃ rect : æç”»é ˜åŸŸ [Rect]
┃ Rectangle.
┃ string : æ画文å—列 [String]
┃ Output text.
┃ align : æ–‡å—æ•´åˆ—å½¢å¼ [Integer]
┃ Alignment.
┃ frame_color : ç¸å–り色 [Color]
┃ Frame color.
┃ 周りを frame_color ã§ç¸å–ã‚Šã—ãŸæ–‡å—列をæç”»ã—ã¾ã™ã€‚
┃ Draws a character string framed in 'frame_color'.
┃
┃ draw_shadow_text(x, y, width, height, string[, align, frame_color])
┃ draw_shadow_text(rect, string[, align, frame_color])
┃ x, y : æ画先座標 [Integer]
┃ Destination.
┃ width, height : æ画サイズ [Integer]
┃ Size.
┃ rect : æç”»é ˜åŸŸ [Rect]
┃ Rectangle.
┃ string : æ画文å—列 [String]
┃ Output text.
┃ align : æ–‡å—æ•´åˆ—å½¢å¼ [Integer]
┃ Alignment.
┃ frame_color : ç¸å–り色 [Color]
┃ Frame color.
┃ å³ä¸‹ã«å½±ã‚’è½ã¨ã—ãŸæ–‡å—列をæç”»ã—ã¾ã™ã€‚
┃ Draws a character string which drops shadow to lower right.
┃
â”—â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”â”
=end
$imported = {} if $imported == nil
$imported["FrameShadowText"] = true
#==============================================================================
# â– Bitmap
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# â— ç¸å–ã‚Šæ–‡å—æç”»
# x, y, width, height, string[, align, frame_color]
# rect, string[, align, frame_color]
#--------------------------------------------------------------------------
def draw_frame_text(*args)
# 引数判定
if args[0].is_a?(Rect)
if args.size >= 2 && args.size <= 4
# 引数を処ç†ç”¨ã®ãƒãƒ¼ã‚«ãƒ«å¤‰æ•°ã¸ã‚³ãƒ”ー
x, y = args[0].x, args[0].y
width, height = args[0].width, args[0].height
string = args[1]
align = args[2].equal?(nil) ? 0 : args[2]
frame_color = args[3].equal?(nil) ? Color.new(0, 0, 0) : args[3]
else
# 引数ãŒä¸æ£ãªã‚‰ã‚¨ãƒ©ãƒ¼ã‚’åã
raise(ArgumentError, "wrong number of arguments(#{args.size} of #{args.size < 2 ? 2 : 4})")
return
end
else
if args.size >= 5 && args.size <= 7
# 引数を処ç†ç”¨ã®ãƒãƒ¼ã‚«ãƒ«å¤‰æ•°ã¸ã‚³ãƒ”ー
x, y, width, height = args
string = args[4]
align = args[5].equal?(nil) ? 0 : args[5]
frame_color = args[6].equal?(nil) ? Color.new(0, 0, 0) : args[6]
else
# 引数ãŒä¸æ£ãªã‚‰ã‚¨ãƒ©ãƒ¼ã‚’åã
raise(ArgumentError, "wrong number of arguments(#{args.size} of #{args.size < 5 ? 5 : 7})")
return
end
end
# å…ƒã®è‰²ã‚’ä¿å˜
origin_color = font.color.dup
# ç¸å–ã‚Š
font.color = frame_color
draw_text(x - 1, y - 1, width, height, string, align)
draw_text(x - 1, y + 1, width, height, string, align)
draw_text(x + 1, y - 1, width, height, string, align)
draw_text(x + 1, y + 1, width, height, string, align)
# å…ƒã®è‰²ã«æˆ»ã™
font.color = origin_color
draw_text(x, y, width, height, string, align)
end
#--------------------------------------------------------------------------
# ◠影文å—æç”»
# x, y, width, height, string[, align, shadow_color]
# rect, string[, align, shadow_color]
#--------------------------------------------------------------------------
def draw_shadow_text(*args)
# 引数判定
if args[0].is_a?(Rect)
if args.size >= 2 && args.size <= 4
# 引数を処ç†ç”¨ã®ãƒãƒ¼ã‚«ãƒ«å¤‰æ•°ã¸ã‚³ãƒ”ー
x, y = args[0].x, args[0].y
width, height = args[0].width, args[0].height
string = args[1]
align = args[2].equal?(nil) ? 0 : args[2]
shadow_color = args[3].equal?(nil) ? Color.new(0, 0, 0) : args[3]
else
# 引数ãŒä¸æ£ãªã‚‰ã‚¨ãƒ©ãƒ¼ã‚’åã
raise(ArgumentError, "wrong number of arguments(#{args.size} of #{args.size < 2 ? 2 : 4})")
return
end
else
if args.size >= 5 && args.size <= 7
# 引数を処ç†ç”¨ã®ãƒãƒ¼ã‚«ãƒ«å¤‰æ•°ã¸ã‚³ãƒ”ー
x, y, width, height = args
string = args[4]
align = args[5].equal?(nil) ? 0 : args[5]
shadow_color = args[6].equal?(nil) ? Color.new(0, 0, 0) : args[6]
else
# 引数ãŒä¸æ£ãªã‚‰ã‚¨ãƒ©ãƒ¼ã‚’åã
raise(ArgumentError, "wrong number of arguments(#{args.size} of #{args.size < 5 ? 5 : 7})")
return
end
end
# å…ƒã®è‰²ã‚’ä¿å˜
origin_color = font.color.dup
# å½±æç”»
font.color = shadow_color
draw_text(x + 2, y + 2, width, height, string, align)
# å…ƒã®è‰²ã«æˆ»ã™
font.color = origin_color
draw_text(x, y, width, height, string, align)
end
end