대화관련
2007.12.06 19:26

글자에 테두리넣기 스크립트

조회 수 2001 추천 수 2 댓글 4
?

단축키

Prev이전 문서

Next다음 문서

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

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form
#==============================================================================
# ■ Bitmap
#------------------------------------------------------------------------------
#  Bitmap클래스 메소드 추가
#==============================================================================

class Bitmap
  #--------------------------------------------------------------------------
  # ● 테두리 문자 묘화
  #--------------------------------------------------------------------------
  def draw_frame_text(x, y, width, height, string, align = 0,
      frame_color = Color.new(0, 0, 0))
    # 원의 색을 보존해 두는
    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
  #--------------------------------------------------------------------------
  # ● 그림자 문자 묘화
  #--------------------------------------------------------------------------
  def draw_shadow_text(x, y, width, height, string, align = 0,
      shadow_color = Color.new(0, 0, 0))
    # 원의 색을 보존해 두는
    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


한 가지 단점이 있습니다.
draw_text메소드는 두 개가 있습니다.

draw_text(x, y, width, height, str[, align])
이 경우 draw_frame_text를 써줘도 되는 경우입니다.

draw_text(rect, str[, align])
이 경우는 써주면 에러나는 경우입니다.

예를 들면 Window_Command섹션에서는
    self.contents.draw_text(rect, @commands[index])
를 써주기 때문에 교체할 수 없고, 따라서 커맨드윈도우를 사용하는 타이틀 메뉴와는 호환이 되지 않습니다.

따라서 그 경우를 위해 아래 스크립트를 넣어줍니다.



#==============================================================================
# ■ Bitmap
#------------------------------------------------------------------------------
#  Bitmap클래스 메소드 추가
#==============================================================================

class Bitmap
  #--------------------------------------------------------------------------
  # ● 테두리 문자 묘화
  #--------------------------------------------------------------------------
  def draw_frame_rectext(rect, string, align = 0,
      frame_color = Color.new(0, 0, 0))
    # 원의 색을 보존해 두는
    origin_color = font.color.dup
    # 인연 잡기
    font.color = frame_color
    draw_text(rect.x - 1, rect.y - 1, rect.width, rect.height, string, align)
    draw_text(rect.x - 1, rect.y + 1, rect.width, rect.height, string, align)
    draw_text(rect.x + 1, rect.y - 1, rect.width, rect.height, string, align)
    draw_text(rect.x + 1, rect.y + 1, rect.width, rect.height, string, align)
    # 원의 색에 되돌려 묘화
    font.color = origin_color
    draw_text(rect, string, align)
  end
  #--------------------------------------------------------------------------
  # ● 그림자 문자 묘화
  #--------------------------------------------------------------------------
  def draw_shadow_rectext(rect, string, align = 0,
      shadow_color = Color.new(0, 0, 0))
    # 원의 색을 보존해 두는
    origin_color = font.color.dup
    # 그림자 묘화
    font.color = shadow_color
    draw_text(rect.x + 2, rect.y + 2, rect.width, rect.height, string, align)
    # 원의 색에 되돌려 묘화
    font.color = origin_color
    draw_text(rect.x, rect.y, rect.width, rect.height, string, align)
  end
end




이것으로 완료입니다.
그리고는 ,
  draw_text(…)

  draw_frame_text(…)
이나
  draw_shadow_text(…)
에 고쳐 쓰면 , 테두리 문자·그림자 문자가 묘화 됩니다.

주:draw_text(rect, string[, align])형식에는 대응하고 있지 않습니다.
대응하도록 고친 스크립트는

  draw_text(…)

  draw_frame_rectext(…)
이나
  draw_shadow_rectext(…)
에 고쳐 쓰면 , 테두리 문자·그림자 문자가 묘화 됩니다.

이제 아래 스크립트로 섹션 Window_Command를 갈아치워줍니다. 왜? 타이틀의 메뉴와 병용하려고.

#==============================================================================
# ■ Window_Command
#------------------------------------------------------------------------------
#  일반적인 커멘드 선택을 실시하는 윈도우입니다.
#==============================================================================

class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #     width    : 윈도우의 폭
  #     commands : 커멘드 캐릭터 라인의 배열
  #--------------------------------------------------------------------------
  def initialize(width, commands)
    # 커멘드의 개수로부터 윈도우의 높이를 산출
    super(0, 0, width, commands.size * 32 + 32)
    @item_max = commands.size
    @commands = commands
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
  #--------------------------------------------------------------------------
  # ● 항목의 묘화
  #     index : 항목 번호
  #     color : 문자색
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_frame_rectext(rect, @commands[index])
  end
  #--------------------------------------------------------------------------
  # ● 항목의 무효화
  #     index : 항목 번호
  #--------------------------------------------------------------------------
  def disable_item(index)
    draw_item(index, disabled_color)
  end
end
------------------------------------------------

#이것으로 저 부분 역시 완료입니다.
  -메소드 사양(클래스:Bitmap)-
 draw_frame_text(x, y, width, height, str[, align, color])
 draw_shadow_text(x, y, width, height, str[, align, color])
[x, y, width, height, str, align]draw_text (와)과 같이.
[color]그림자의 색.

--------------------------------------------------


출처: 창조도시

  1. 일본어 스크립트를 번역하기 좋은 번역사이트 두곳입니다

    Date2010.01.09 Category공지사항 Byruby Views22086 Votes0
    read more
  2. 스크립트 게시판 관리자' ruby ' 입니다

    Date2010.01.09 Category공지사항 Byruby Views20726 Votes0
    read more
  3. 일본 스크립트/소스 공유 포럼

    Date2010.01.05 Category공지사항 By니오티 Views22257 Votes0
    read more
  4. 한글자씩 글자 나오는거 완전판!!(오류 하나도 없음)

    Date2013.07.09 Category대화관련 By만원만주라 Views2123 Votes0
    Read More
  5. 대화 창에 얼굴 넣기 스크립트

    Date2011.08.08 Category대화관련 By노르 Views3446 Votes0
    Read More
  6. 얼굴 띄워주는 기능&대화창 명령어

    Date2010.07.23 Category대화관련 By니오티 Views2904 Votes0
    Read More
  7. 문장 색 추가하기 스크립트

    Date2008.01.09 Category대화관련 ByHermes Views2133 Votes4
    Read More
  8. 글자에 테두리넣기 스크립트

    Date2007.12.06 Category대화관련 By아하하 Views2001 Votes2
    Read More
Board Pagination Prev 1 Next
/ 1

Copyright ⓒ Nioting All Rights Reserved. (since 1999)    개인정보
        

Fatal error: Cannot access property sessionController::$lifetime in /web/old/xe/modules/session/session.controller.php on line 45