메시지

문자픽쳐 표시 스크립트

by 좀비사냥꾼 posted Mar 19, 2009
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄


스크립트로 문장을 적으면 화면상에 픽쳐로서 표시가 됩니다
따라서 캐릭터가 이동하고 있는 중에도 문자가 표시된답니다.

위의 스크린샷에서 보이는것처럼 이벤트스크립트로 문장을 적어준다음에
그림의표시를 하시면됩니다.


#==============================================================================
# 걳RGSS2 
# STR27_빒럻긯긏?긿맯맟 v1.1 08/09/05
# 긖??긣갌http://strcatyou.u-abel.net/
#
# 갋럚믦궢궫빒럻쀱귩긯긏?긿?렑궠궧귏궥갃
#
# 걾럊뾭뺴?
#?댥돷궻긚긏깏긵긣귩귽긹깛긣긓?깛긤궳렳뛱궢궫뚣갂
#?긯긏?긿궻?렑"긓?깛긤궳빒럻긯긏?긿귩?렑궠궧귏궥갃
=begin
궞궞궔귞

# 긡긌긚긣
t = "hogehoge"
s = 20 # 빒럻긖귽긛
p = 0  # 긲긅깛긣긬??깛
text_picture(t, p, s)

궞궞귏궳
=end
#
# 겍긲긅깛긣긬??깛궼돷궻먠믦됒룋궳믦?궢귏궥갃
# 겍긲긅깛긣긖귽긛궕룷궠궥궗궫귟묈궖궥궗궫귟궥귡궴
# ?긄깋?궕궳귏궥갃뭾댰궢궲궘궬궠궋갃
#
#------------------------------------------------------------------------------
#
# 뛛륷뿗쀰
# 걻1.0겏1.1
#?""볙궻둂뛱됒룋궶궵궳쪈첈렑궠귢귡긫긐귩뢇맫
#
#==============================================================================
# 걳 긲긅깛긣긬??깛믦?(먠믦됒룋)
#==============================================================================
module STRRGSS2
  #              겓뫮돒궥귡뭠
                # 믅륂궻빒럻
  STR27_FLIST = {0 => ["UmePlus Gothic",      # 긲긅깛긣뼹
                       false,                 # 뫞럻
                       false,                 # 롈뫬
                       true,                  # 뎓빒럻
                       false,                 # 뎼롦귟
                       Color.new(255,255,255),# 빒럻륡
                       Color.new( 64, 32,128) # 뎼롦귟륡
                       ],
                # 롈귕갋뎼롦귟
                 1 => ["UmePlus Gothic",      # 긲긅깛긣뼹
                       false,                 # 뫞럻
                       true,                  # 롈뫬
                       true,                  # 뎓빒럻
                       true,                  # 뎼롦귟
                       Color.new(255,255,255),# 빒럻륡
                       Color.new( 64, 32,128) # 뎼롦귟륡
                       ],
                 }
#
end
#==============================================================================
# 걾 Game_Interpreter
#==============================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # 걶 빒럻긯긏?긿럚믦
  #--------------------------------------------------------------------------
  def text_picture(text, p = 0, size = 20)
    strfp = STRRGSS2::STR27_FLIST[p]
    font = Font.new(strfp[0], size)
    font.bold = strfp[1] ; font.italic = strfp[2]
    font.shadow = strfp[3] ; font.color = strfp[5]
    text.gsub!(/[tnrf]*/,"")
    @strtxpic = [text, STR_DumpFont.new(font, strfp[4], strfp[6])]
  end
  #--------------------------------------------------------------------------
  # 걶 긯긏?긿궻?렑(긄귽깏귺긚)
  #--------------------------------------------------------------------------
  alias command_231_str27 command_231
  def command_231
    @params[1] = @strtxpic if @strtxpic != nil ; @strtxpic = nil
    command_231_str27
  end
end
#==============================================================================
# 걾 Sprite_Picture
#==============================================================================
class Sprite_Picture < Sprite
  #--------------------------------------------------------------------------
  # 걶 긲깒??뛛륷(긄귽깏귺긚)
  #--------------------------------------------------------------------------
  alias update_str27 update
  def update
    if @picture.name.is_a?(Array) and @picture_name != @picture.name 
      # 빒럻긯긏?긿
      @picture_name = @picture.name
      if @picture_name != ""
        self.bitmap.dispose if self.bitmap != nil and not @picture_name.is_a?(String)
        f = @picture_name[1].undump
        # 빒럻긖귽긛롦벦
        self.bitmap =Bitmap.new(1, 1) ; self.bitmap.font = f[0]
        size = self.bitmap.text_size(@picture_name[0])
        size.width += f[0].size / 4 if f[0].italic
        size.width += 4 ; self.bitmap.dispose
        # 귽긽?긙띿맟
        self.bitmap = Bitmap.new(size.width + 2, size.height + 2) ; self.bitmap.font = f[0]
        unless f[1]
          self.bitmap.draw_text(1, 1, size.width, size.height, @picture_name[0])
        else
          self.bitmap.draw_text_f(1, 1, size.width, size.height, @picture_name[0], 0, f[2])
        end
      end
    elsif @picture_name != @picture.name
      # 믅륂긯긏?긿
      @picture_name = @picture.name
      if @picture_name != ""
        self.bitmap.dispose unless @picture_name.is_a?(String)
        self.bitmap = Cache.picture(@picture_name)
      end
    end
    # 뚁귂뽣궢
    update_str27
  end
end
#==============================================================================
# 걾 Bitmap
#==============================================================================
class Bitmap
  #--------------------------------------------------------------------------
  # 걶 빒럻뎼롦귟?됪
  #--------------------------------------------------------------------------
  def draw_text_f(x, y, width, height, str, align = 0, color = Color.new(64,32,128))
    shadow = self.font.shadow
    b_color = self.font.color.dup
    font.shadow = false
    font.color = color
    draw_text(x + 1, y, width, height, str, align) 
    draw_text(x - 1, y, width, height, str, align) 
    draw_text(x, y + 1, width, height, str, align) 
    draw_text(x, y - 1, width, height, str, align) 
    font.color = b_color
    draw_text(x, y, width, height, str, align)
    font.shadow = shadow
  end
  def draw_text_f_rect(r, str, align = 0, color = Color.new(64,32,128)) 
    draw_text_f(r.x, r.y, r.width, r.height, str, align = 0, color) 
  end
end
#==============================================================================
# 걾 STR_DumpFont
#==============================================================================
class STR_DumpFont
  #--------------------------------------------------------------------------
  # 걶 룊딖돸
  #--------------------------------------------------------------------------
  def initialize(font, edge, ed_color)
    @name = font.name ; @size = font.size
    @bold = font.bold ; @italic = font.italic
    @shadow = font.shadow ; @edge = edge ; @ed_color = ed_color.clone
    @color = Color.new(font.color.red,font.color.green,font.color.blue,font.color.alpha)
  end
  #--------------------------------------------------------------------------
  # 걶 빾듂
  #--------------------------------------------------------------------------
  def undump
    font = Font.new(@name, @size)
    font.bold = @bold ; font.italic = @italic
    font.shadow = @shadow ; font.color = @color
    return [font, @edge, @ed_color]
  end
end