#------------------------------------------------------------------------------
#
# * TEXT EFFECTS *
#-------------------------------------------------------------------------------
# Draw Text with the newer text formats: Outlined, Raised and Shadowed, and any
# combination of the three.
#-------------------------------------------------------------------------------
#
# This class redefines the draw_text system to include outlined, raised and sha-
# dowed text styles.
#
# Revised Syntax for draw_text:
#
# Normal Text Call:
# draw_text(x, y, wd, ht, text, align, style, outline, raised, shadow)
#
# Rectangle Text Call:
# draw_text(rect, text, align, style)
# - Can only use default colors using rect style drawing technique. -
#
# x & y = coordinates to draw
#
# wd & ht = size of drawing area
#
# rect = rectangle to draw text (predefined x, y, wd, ht)
#
# style = how text should be shown. Default = 0 (normal text)
# 0 = Normal
# 1 = Outline Effect
# 2 = Raised Effect
# 3 = Shadowed Effect
# 4 = Raised Effect and Outlined
# 5 = Shadowed Effect and Outlined
# 6 = Raised Effect and Shadowed
# 7 = Raised, Shadowed and Outlined
#
# The Colors:...
# outline = (default = black) Color of outline drawn around text
# raised = (default = medium gray) Color of shadow right behind text
# shadow = (default = dark gray) Color of shadow spaced behind the text
#
#==============================================================================
# ** Bitmap (Default System/Script Edit)
#------------------------------------------------------------------------------
# This class controls what is displayed on the screen
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# * Alias Draw_Text (Use original "Draw_Text" command by calling as "Text"
#--------------------------------------------------------------------------
alias :text :draw_text
#--------------------------------------------------------------------------
# * Draw_Text
#--------------------------------------------------------------------------
def draw_text(x, y=nil, wd=0, ht=0, text=nil, align=0, style=0,
outline = Color.new(0, 0, 0, 255), raised = Color.new(96, 96, 96, 255),
shadow = Color.new(0, 0, 0, 128))
# If drawing with a rectangle command
if x.is_a?(Rect)
@x = x.x
@y = x.y
@wd = x.width
@ht = x.height
@text = y
@align = wd
@style = ht
# If drawing with regular command
else
@x = x
@y = y
@wd = wd
@ht = ht
@text = text
@align = align
@style = style
end
# Perform drawing style
case @style
#--------------------------------------------------------------------------
# * Normal Text
#--------------------------------------------------------------------------
when 0
text(@x, @y, @wd, @ht, @text, @align)
#--------------------------------------------------------------------------
# * Outlined Effect
#--------------------------------------------------------------------------
when 1
base_clr = font.color.dup
font.color = outline
text(@x+1, @y, @wd, @ht, @text, @align)
text(@x-1, @y, @wd, @ht, @text, @align)
text(@x, @y+1, @wd, @ht, @text, @align)
text(@x, @y-1, @wd, @ht, @text, @align)
font.color = base_clr
text(@x, @y, @wd, @ht, @text, @align)
#--------------------------------------------------------------------------
# * Raised Effect
#--------------------------------------------------------------------------
when 2
base_clr = font.color.dup
font.color = raised
text(@x+2, @y+2, @wd, @ht, @text, @align)
text(@x+1, @y+1, @wd, @ht, @text, @align)
font.color = base_clr
text(@x, @y, @wd, @ht, @text, @align)
#--------------------------------------------------------------------------
# * Shadowed Effect
#--------------------------------------------------------------------------
when 3
base_clr = font.color.dup
font.color = shadow
text(@x+4, @y+4, @wd, @ht, @text, @align)
font.color = base_clr
text(@x, @y, @wd, @ht, @text, @align)
#--------------------------------------------------------------------------
# * Raised Effect and Outlined
#--------------------------------------------------------------------------
when 4
base_clr = font.color.dup
font.color = raised
text(@x+2, @y+2, @wd, @ht, @text, @align)
text(@x+1, @y+1, @wd, @ht, @text, @align)
font.color = outline
text(@x+1, @y, @wd, @ht, @text, @align)
text(@x-1, @y, @wd, @ht, @text, @align)
text(@x, @y+1, @wd, @ht, @text, @align)
text(@x, @y-1, @wd, @ht, @text, @align)
font.color = base_clr
text(@x, @y, @wd, @ht, @text, @align)
#--------------------------------------------------------------------------
# * Shadowed Effect and Outlined
#--------------------------------------------------------------------------
when 5
base_clr = font.color.dup
font.color = shadow
text(@x+4, @y+4, @wd, @ht, @text, @align)
font.color = outline
text(@x+1, @y, @wd, @ht, @text, @align)
text(@x-1, @y, @wd, @ht, @text, @align)
text(@x, @y+1, @wd, @ht, @text, @align)
text(@x, @y-1, @wd, @ht, @text, @align)
font.color = base_clr
text(@x, @y, @wd, @ht, @text, @align)
#--------------------------------------------------------------------------
# * Raised Effect and Shadowed
#--------------------------------------------------------------------------
when 6
base_clr = font.color.dup
font.color = shadow
text(@x+4, @y+4, @wd, @ht, @text, @align)
font.color = raised
text(@x+2, @y+2, @wd, @ht, @text, @align)
text(@x+1, @y+1, @wd, @ht, @text, @align)
font.color = base_clr
text(@x, @y, @wd, @ht, @text, @align)
#--------------------------------------------------------------------------
# * Raised, Shadowed and Outlined
#--------------------------------------------------------------------------
when 7
base_clr = font.color.dup
font.color = shadow
text(@x+4, @y+4, @wd, @ht, @text, @align)
font.color = raised
text(@x+2, @y+2, @wd, @ht, @text, @align)
text(@x+1, @y+1, @wd, @ht, @text, @align)
font.color = outline
text(@x+1, @y, @wd, @ht, @text, @align)
text(@x-1, @y, @wd, @ht, @text, @align)
text(@x, @y+1, @wd, @ht, @text, @align)
text(@x, @y-1, @wd, @ht, @text, @align)
font.color = base_clr
text(@x, @y, @wd, @ht, @text, @align)
end
end
#--------------------------------------------------------------------------
# * End of Class
#--------------------------------------------------------------------------
end