조회 수 1555 추천 수 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

Who's 창조도시

profile

도움이 필요하면 메일이나 민원실 이용해주세요.

chunmu1@naver.com

 

 

?

  1. 한글조합입력기(영어가능)

    Date2019.11.10 CategoryRPGXP 스크립트 By조규진1 Views946 Votes0
    Read More
  2. RPG XP Xas액알

    Date2018.10.30 CategoryRPGXP 스크립트 By심심치 Views1161 Votes0
    Read More
  3. Font Setup

    Date2016.07.22 CategoryRPGXP 스크립트 By운님 Views1641 Votes0
    Read More
  4. 대화에 얼굴이 나오는 스크립트 by: killarot(네이버 dust_mite)(수정버전)

    Date2016.02.22 CategoryRPGXP 스크립트 By부초 Views2043 Votes0
    Read More
  5. RPGXP ATB전투 시스템 예제(스크립트는 예제 안에 포함)

    Date2015.11.17 CategoryRPGXP 스크립트 ByMagNesium Views870 Votes0
    Read More
  6. 스테이터스,보수,골드,플레임 타임 삭제

    Date2015.06.02 CategoryRPGXP 스크립트 Byrpgmakingbot Views847 Votes0
    Read More
  7. 헤드 업 디스플레이 스크립트

    Date2015.01.30 CategoryRPGXP 스크립트 By 운 Views958 Votes0
    Read More
  8. 컬러 비트맵 타이틀 스크립트

    Date2015.01.20 CategoryRPGXP 스크립트 By 운 Views912 Votes1
    Read More
  9. 로고 스크립트

    Date2014.12.10 CategoryRPGXP 스크립트 By 운 Views1257 Votes1
    Read More
  10. 타이틀 로딩 스크립트

    Date2014.12.07 CategoryRPGXP 스크립트 By 운 Views1148 Votes0
    Read More
  11. 타이틀 스크립트

    Date2014.12.05 CategoryRPGXP 스크립트 By 운 Views1121 Votes0
    Read More
  12. 액알 스크립트

    Date2014.11.23 CategoryRPGXP 스크립트 By커비♥ Views1527 Votes1
    Read More
  13. 공포게임에 장비착용메뉴

    Date2014.08.24 CategoryRPGXP 스크립트 By 운 Views1506 Votes0
    Read More
  14. 얼굴표시/문장을 한글자씩 나타내주는 스크립트 (출처-히페리온)

    Date2014.06.22 CategoryRPGXP 스크립트 By시르카 Views1285 Votes0
    Read More
  15. 횡스크롤 점프 [버튼허용스위치추가]

    Date2014.06.01 CategoryRPGXP 스크립트 By 운 Views1722 Votes0
    Read More
  16. 말풍선 메세지 스크립트

    Date2014.02.24 CategoryRPGXP 스크립트 By천둥번들 Views1936 Votes0
    Read More
  17. 스텟찍기스크립트

    Date2014.02.22 CategoryRPGXP 스크립트 By천둥번들 Views1920 Votes3
    Read More
  18. 달리기스크립트

    Date2014.02.22 CategoryRPGXP 스크립트 By천둥번들 Views2391 Votes2
    Read More
  19. 8방향 이동스크립트

    Date2014.02.22 CategoryRPGXP 스크립트 By천둥번들 Views1827 Votes6
    Read More
  20. AraLab_MultiStartingPoint (다중 출발점 스크립트, 캐릭터 선택 스크립트) ver.0.2beta

    Date2014.01.21 CategoryRPGXP 스크립트 By 운 Views2065 Votes1
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 Next
/ 8


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

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