조회 수 1888 추천 수 1 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

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

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
문자에 테두리를 표시하는 스크립트입니다..

하는 김에 그림자 문자도 묘화 가능합니다.

draw_text 대신에 사용할 수 있습니다.

 주의:전투중에 「테두리 문자」를 사용하면(자) 쓸데없게 렉걸릴수도 있습니다..

      전투중은 가능한 한 「그림자 문자」또는 draw_text 을 사용해 주세요.

그럼 추가해보도록 하죠~

이번에 작업할 스크립트 섹션은 'Bitmap(신규)'입니다..Bitmap이란 섹션을 만드세요..

그런후  아래스크립트를 고대로 복사해 붙여넣으시기바랍니다..


#==============================================================================
# ■ 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]그림자의 색.

출저 : KGC
?

  1. 기차 파티 스크립트

    Date2008.07.24 CategoryRPGXP 스크립트 By창조도시 Views1466 Votes2
    Read More
  2. 기차 파티 스크립트

    Date2008.07.24 CategoryRPGXP 스크립트 By창조도시 Views1879 Votes2
    Read More
  3. 그림자문자 사용하기.. 바탕색이 무슨색이건 상관없이 글자가 잘보인다!!!

    Date2007.11.06 CategoryRPGXP 스크립트 By창조도시 Views1475 Votes1
    Read More
  4. 그림자문자 사용하기.. 바탕색이 무슨색이건 상관없이 글자가 잘보인다!!!

    Date2007.11.06 CategoryRPGXP 스크립트 By창조도시 Views1888 Votes1
    Read More
  5. 그레고리우스력 원리.

    Date2011.06.22 CategoryRPGXP 스크립트 By협객 Views2506 Votes0
    Read More
  6. 그레고리우스력 원리.

    Date2011.06.22 CategoryRPGXP 스크립트 By협객 Views2754 Votes0
    Read More
  7. 구간 루프 음악 스크립트

    Date2015.08.24 Category유니티 스크립트 By맛난호빵 Views234 Votes0
    Read More
  8. 공포게임에 장비착용메뉴

    Date2014.08.24 CategoryRPGXP 스크립트 By 운 Views1423 Votes0
    Read More
  9. 경험치 표시 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views750 Votes0
    Read More
  10. 게임프레임 조절

    Date2013.09.20 CategoryRPGXP 스크립트 By청담 Views1814 Votes0
    Read More
  11. 게임에서 제공해주는 노래가 아닌 외부에서 다운받고 안에 넣어쓰려면 어떻게 해야하나요?

    Date2019.07.26 CategoryRPGMV 플러그인 ByBigOrca Views1197 Votes0
    Read More
  12. 게임시작하면 바로 뉴게임으로 가는 플러그인!

    Date2015.11.07 CategoryRPGMV 플러그인 Bywillmv Views927 Votes0
    Read More
  13. 게임도중에 글씨체를 바꿔보자.

    Date2008.12.31 CategoryRPGXP 스크립트 By창조도시 Views1266 Votes1
    Read More
  14. 게임도중에 글씨체를 바꿔보자.

    Date2008.12.31 CategoryRPGXP 스크립트 By창조도시 Views1653 Votes1
    Read More
  15. 간단한 여관 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views911 Votes0
    Read More
  16. 가상 키보드 입력 스크립트

    Date2013.10.01 CategoryRPGXP 스크립트 By Views1660 Votes0
    Read More
  17. [아힝흥행]레벨한계 돌파 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By아힝흥행 Views1099 Votes0
    Read More
  18. [무한응용]스위치/변수 임시 저장/로딩하기

    Date2010.04.10 CategoryRPGXP 스크립트 By카리스 Views2594 Votes1
    Read More
  19. [무한응용]스위치/변수 임시 저장/로딩하기

    Date2010.04.10 CategoryRPGXP 스크립트 By카리스 Views2633 Votes1
    Read More
  20. [鳥小屋] 실적 플러그인(인게임 트로피 시스템)

    Date2017.10.31 CategoryRPGMV 플러그인 By이니군 Views1553 Votes0
    Read More
Board Pagination Prev 1 ... 5 6 7 8 9 10 11 12 13 14 15 Next
/ 15






[개인정보취급방침] | [이용약관] | [제휴문의] | [후원창구] | [인디사이드연혁]

Copyright © 1999 - 2016 INdiSide.com/(주)씨엘쓰리디 All Rights Reserved.
인디사이드 운영자 : 천무(이지선) | kernys(김원배) | 사신지(김병국)