【RGSS3】顔グラのサイズ変更スクリプト

アバター
alan
記事: 82
登録日時: 2015年12月29日(火) 21:41
お住まい: 神奈川

【RGSS3】顔グラのサイズ変更スクリプト

投稿記事by alan » 2016年6月02日(木) 10:26

お久し振りです。
顔グラのサイズ変更をRGSS3で探しているのですが
有りますでしょうか?

ツクール2000からの、ツクラーです。
faida
記事: 272
登録日時: 2015年12月17日(木) 16:44

Re: 【RGSS3】顔グラのサイズ変更スクリプト

投稿記事by faida » 2016年6月10日(金) 16:03

こんなのでよろしければどうぞ。

コード: 全て選択

=begin
◆概要
メッセージウィンドウと顔グラフィックの描画領域を別にします。

◆機能
・導入するだけでなんとでも。

◆仕様
・顔グラフィックのサイズは 画像の横 / FACE_NUM で自動算出します。

◆使用上の注意
・●……再定義 ★……エイリアス

=end

module FAI_ScriptSet
  FACE_NUM = 4
end

#==============================================================================
# ■ Window_Message
#==============================================================================

class Window_Message < Window_Base
  #--------------------------------------------------------------------------
  # ★ インスタンス変数のクリア
  #--------------------------------------------------------------------------
  alias fs_clear_instance_variables clear_instance_variables
  def clear_instance_variables
    fs_clear_instance_variables
    @face_sprite.dispose if @face_sprite; @face_sprite = Sprite.new
    @face_sprite.x = 0; @face_sprite.y = y; @face_sprite.z = 300
    @face_sprite.bitmap = Bitmap.new(window_height, window_height)
    @face_sprite.visible = true
  end
  #--------------------------------------------------------------------------
  # ★ 背景ビットマップの解放
  #--------------------------------------------------------------------------
  alias fs_dispose_back_bitmap dispose_back_bitmap
  def dispose_back_bitmap
    fs_dispose_back_bitmap; @face_sprite.bitmap.dispose; @face_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # ★ 改ページ処理
  #--------------------------------------------------------------------------
  alias fs_new_page new_page
  def new_page(text, pos)
    @face_sprite.bitmap.clear; fs_new_page(text, pos)
  end
  #--------------------------------------------------------------------------
  # ● 顔グラフィックの描画
  #--------------------------------------------------------------------------
  def draw_face(face_name, face_index, x, y)
    bitmap = Cache.face(face_name)
    s = bitmap.width / FAI_ScriptSet::FACE_NUM; t = (window_height - s) / 2
    rect = Rect.new(face_index % 4 * s, face_index / 4 * s, s, s)
    @face_sprite.bitmap.blt(x + t, y + t, bitmap, rect); bitmap.dispose
  end
  #--------------------------------------------------------------------------
  # ★ 開く処理の更新
  #--------------------------------------------------------------------------
  alias fs_update_open update_open
  def update_open; fs_update_open; @face_sprite.visible = true if open?; end
  #--------------------------------------------------------------------------
  # ★ ウィンドウを閉じる
  #--------------------------------------------------------------------------
  alias fs_close close
  def close; @face_sprite.visible = false; fs_close; end
  #--------------------------------------------------------------------------
  # ★ ウィンドウ位置の更新
  #--------------------------------------------------------------------------
  alias fs_update_placement update_placement
  def update_placement
    fs_update_placement
    @face_sprite.y = @position * (Graphics.height - height) / 2
  end
  #--------------------------------------------------------------------------
  # ● 改行位置の取得
  #--------------------------------------------------------------------------
  def new_line_x
    $game_message.face_name.empty? ? 0 :
    Cache.face($game_message.face_name).width / FAI_ScriptSet::FACE_NUM + 16
  end
end
------------------------------------------------------------------
自作の(改造でない)スクリプト、プラグイン素材に
関しては、リードミーもしくは作中に
「faida」と記名していただければ
利用可能です。
アバター
alan
記事: 82
登録日時: 2015年12月29日(火) 21:41
お住まい: 神奈川

Re: 【RGSS3】顔グラのサイズ変更スクリプト

投稿記事by alan » 2016年6月13日(月) 21:22

有難う御座います!
ツクール2000からの、ツクラーです。

“VX / Ace:スクリプト素材のリクエスト” へ戻る