#============================================================================== # ■ Window_Base #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● ピクチャ描画(Graphics/Pictures内の画像を表示) # file_name : 画像ファイル名 # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_picture(file_name, x, y) bitmap = RPG::Cache.picture(file_name) cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x, y, bitmap, src_rect) end end class Window_Base < Window #-------------------------------------------------------------------------- # ● アイコン描画(Graphics/Icons内の画像を表示) # file_name : 画像ファイル名 # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_icon(file_name, x, y) bitmap = RPG::Cache.icon(file_name) cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x, y, bitmap, src_rect) end end class Window_Base < Window #-------------------------------------------------------------------------- # ● バトラー描画(Graphics/Battlers内の画像を表示) # file_name : 画像ファイル名 # x : 描画先 X 座標 # y : 描画先 Y 座標 # hue : 色相変化値(省略可) #-------------------------------------------------------------------------- def draw_battler(file_name, x, y, hue = 0) bitmap = RPG::Cache.battler(file_name, hue) cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x, y, bitmap, src_rect) end end class Window_Base < Window #-------------------------------------------------------------------------- # ● 現在値(マップ名)表示 # x : 描画先 X 座標 # y : 描画先 Y 座標 # width : 文字列の幅 # height : 文字列の高さ #-------------------------------------------------------------------------- def draw_map_name(x, y, width, height) map_id = $game_map.map_id # マップ情報読み出し mapInfo = load_data(sprintf("Data/MapInfos.rxdata")) self.contents.draw_text(x, y, width, height, mapInfo[map_id].name.to_s) end end class Window_Base < Window #-------------------------------------------------------------------------- # ● ゲージ表示 # x : 描画先 X 座標 # y : 描画先 Y 座標 # current : 表示率(%) # file : 表示ファイル名(Graphics/picture) #-------------------------------------------------------------------------- def draw_bar(x, y, current, file) bitmap = RPG::Cache.picture(file) cw = bitmap.width * current / 100 ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x, y, bitmap, src_rect) end end class Window_Base < Window #-------------------------------------------------------------------------- # ● 改行を認識して表示 # x : 表示先 X 座標 # y : 表示先 Y 座標 # width : 表示横幅 # height : 表示縦幅 # text ; 表示文字 #-------------------------------------------------------------------------- def draw_enter_text(x, y, width, height, text) info_box = text.split(/\n/) for i in 0...info_box.size self.contents.draw_text( x, y + i * 32, width, 32, info_box[i]) break if (y + i * 32) > (self.height - 32) end end end