?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
문자에 테두리를 표시하는 스크립트입니다..

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

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. Mog_Battle_hud(MZ버전도 있습니다)

    Date2021.03.05 CategoryRPGMV Plugin By스트레이보우 Views2012 Votes0
    Read More
  2. 컷신 플러그인

    Date2020.10.30 CategoryRPGMV Plugin By스트레이보우 Views2694 Votes0
    Read More
  3. 업적플러그인

    Date2020.09.02 CategoryRPGMV Plugin By스트레이보우 Views2267 Votes0
    Read More
  4. 한글조합입력기(영어가능)

    Date2019.11.10 CategoryRPGXP Script By조규진1 Views1205 Votes0
    Read More
  5. 게임에서 제공해주는 노래가 아닌 외부에서 다운받고 안에 넣어쓰려면 어떻게 해야하나요?

    Date2019.07.26 CategoryRPGMV Plugin ByBigOrca Views1652 Votes0
    Read More
  6. Ghost Effect

    Date2019.01.20 CategoryRPGMV Plugin By러닝은빛 Views1325 Votes0
    Read More
  7. RPG XP Xas액알

    Date2018.10.30 CategoryRPGXP Script By심심치 Views1332 Votes0
    Read More
  8. 커스텀 숫자 입력 패드

    Date2018.10.19 CategoryRPGMV Plugin By러닝은빛 Views1399 Votes0
    Read More
  9. 9마리 이상의 몬스터 설정 | More Enemies

    Date2018.08.31 CategoryRPGMV Plugin By러닝은빛 Views1152 Votes0
    Read More
  10. 동적 맵 타일 수정 플러그인

    Date2018.07.17 CategoryRPGMV Plugin By베지테리안카카오 Views1252 Votes0
    Read More
  11. VXA에서 XBOX360 컨트롤러 사용 여부 체크

    Date2018.07.15 CategoryRPGVX Ace script By러닝은빛 Views1054 Votes0
    Read More
  12. RMMV 옵션 창에 메시지 속도 및 글자 크기 변경 기능 추가

    Date2018.07.15 CategoryRPGMV Plugin By러닝은빛 Views1799 Votes0
    Read More
  13. 한글 데미지 표시

    Date2018.07.09 CategoryRPGMV Plugin By러닝은빛 Views1618 Votes0
    Read More
  14. [ MV ] 심장[체력표시 하트] 플러그인

    Date2018.07.01 CategoryRPGMV Plugin By수성의물 Views2409 Votes0
    Read More
  15. [鳥小屋] 실적 플러그인(인게임 트로피 시스템)

    Date2017.10.31 CategoryRPGMV Plugin By이니군 Views1910 Votes0
    Read More
  16. LuD Script Package

    Date2017.08.16 CategoryRPGVX Ace script ByLuD Views1824 Votes0
    Read More
  17. [VXAce] 레이어 맵 <layer> 시스템

    Date2017.08.07 CategoryRPGVX Ace script ByLuD Views1479 Votes0
    Read More
  18. [RPG MV] 퀘스트 마커 지속 표시 플러그인

    Date2017.04.09 CategoryRPGMV Plugin Bylklslel Views1881 Votes0
    Read More
  19. Mirror Area - RPG Maker MV

    Date2017.01.03 CategoryRPGMV Plugin By러닝은빛 Views5182 Votes0
    Read More
  20. Keyboard Event - RPG Maker MV

    Date2017.01.03 CategoryRPGMV Plugin By러닝은빛 Views2457 Votes0
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 15 Next
/ 15


[privacy statements] | [Terms of Use] | [Contact us] | [Sponsorship] | [Indiside History]

Copyright © 1999 - 2016 INdiSide.com/CL3D Co., Ltd. All Rights Reserved.
Owner : Chunmu(Jiseon Lee) | kernys(Wonbae Kim) | Sasinji(Byungkook Kim)