#============================================================================== # ○ボトムキーヘルプ in VX Ace By 貪藻矢射妥← # 今は無きスクリプトシェルフ(のOut of Support Scripts)の # ステータス・ウィンドウインフロントにあったボトムキーヘルプを参考に # 拡張を行ってみました。 #============================================================================== # 変更履歴 # まだなし module BTN_SET # キー情報の色 KEY_COLOR = Color.new(160, 255, 255, 255) # ヘルプの色 DRAW_COLOR = Color.new(180, 255, 220, 255) # 描画フォント DRAW_FONT = ["HGPゴシックM", Font.default_name] # ボタンの画像 # ※画像はGraphics/Systemフォルダにインポートしてください BTN_A = "btn_a" BTN_B = "btn_b" BTN_C = "btn_c" BTN_X = "btn_x" BTN_Y = "btn_y" BTN_Z = "btn_z" BTN_LR = "btn_2lr" BTN_XY = "btn_2xy" BTN_CLR = "btn_clr" BTN_CUD = "btn_cud" BTN_CLRUD = "btn_clrud" # ボタンの画像セット # ※ボタンを画像にする場合、キー情報は必ずこのハッシュのキーにしてください BTN_HASH = { "A" =>BTN_A, "B" =>BTN_B, "C" =>BTN_C, "X" =>BTN_X, "Y" =>BTN_Y, "Z" =>BTN_Z, "LR" =>BTN_LR, "XY" =>BTN_XY, "←→"=>BTN_CLR, "↑↓"=>BTN_CUD, "矢印"=>BTN_CLRUD, } # 画像を使うかどうか USE_PIC = true # キー情報の描画サイズ KEY_SIZE = 20 # ヘルプの描画サイズ DRAW_SIZE = 16 # 余白サイズ BLANK = 24 end #============================================================================== # □ Window_BottomKeyHelp #------------------------------------------------------------------------------ # 画面下で操作説明をする透明なウィンドウです。 #============================================================================== class Window_BottomKeyHelp < Window_Base include BTN_SET #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 416-48, 544, 48) self.windowskin = nil clear end #-------------------------------------------------------------------------- # ○ クリア #-------------------------------------------------------------------------- def clear contents.clear @now_x = 544 - 32 end #-------------------------------------------------------------------------- # ○ 追加 # key : ボタンの情報 # explanation : ヘルプ #-------------------------------------------------------------------------- def add(key, explanation) # 描画位置の計算 font = contents.font.name root_color = contents.font.color contents.font.name = DRAW_FONT if USE_PIC x = KEY_SIZE else contents.font.size = KEY_SIZE x = contents.text_size(key).width end contents.font.size = DRAW_SIZE x += contents.text_size(explanation).width + 8 @now_x -= x # 描写 if USE_PIC pic = Cache.system(BTN_HASH[key]) contents.blt(@now_x, 0 + 4, pic, pic.rect) # アイコンサイズが24×24じゃない場合はこっち? #dest_rect = Rect.new(@now_x, 0 + 4, KEY_SIZE, KEY_SIZE) #contents.stretch_blt(dest_rect, pic, pic.rect) pic.dispose else contents.font.size = KEY_SIZE contents.font.color = KEY_COLOR draw_text(@now_x, 0, x, 32, key) end contents.font.size = DRAW_SIZE contents.font.color = DRAW_COLOR draw_text(@now_x, 0, x, 32, explanation, 2) # 余白の設定 if @now_x < 0 msgbox "描画しきれません!" end @now_x -= BLANK contents.font.name = font contents.font.color = root_color end #-------------------------------------------------------------------------- # ○ セッティング # hash : キーとヘルプのハッシュ # (ハッシュの内容が1つしかない場合、addでOKだったり・・・) #-------------------------------------------------------------------------- def set_bottom_help(hash) for key in hash.keys add(key, hash[key]) end end end |