sacred-ritual-academy/Scripts/_.37.rb
2025-03-18 19:45:34 -05:00

117 lines
4.7 KiB
Ruby
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#******************************************************************************
#
# スクリーンショット
#
# --------------------------------------------------------------------------
# バージョン 1.0.4
# 対 応 RPGツクールVX Ace : RGSS3
# 制 作 者
# 配 布 元 http://cacaosoft.webcrow.jp/
# --------------------------------------------------------------------------
# == 概 要 ==
#
# 現在のゲーム画面を画像保存します。
#
# --------------------------------------------------------------------------
# == 注意事項 ==
#
# ※ このスクリプトの実行には、『PNG 保存』のスクリプトが必要です。
# ※ 画像の保存中は、ゲームが停止します。
#
# --------------------------------------------------------------------------
# == 使用方法 ==
#
# ★ 撮影する
# PrintScreen(PrtScn) キー を押してください。
#
#
#******************************************************************************
#==============================================================================
# ◆ 設定項目
#==============================================================================
module CAO
module SS
#--------------------------------------------------------------------------
# ◇ 保存名
#--------------------------------------------------------------------------
SAVE_NAME = "ScreenShot/%Y%m%d%H%M%S.png"
#--------------------------------------------------------------------------
# ◇ ロゴ追加
#--------------------------------------------------------------------------
FILE_LOGO = ""
#--------------------------------------------------------------------------
# ◇ 撮影時の効果音
#--------------------------------------------------------------------------
FILE_SOUND = RPG::SE.new("Key", 100, 150)
#--------------------------------------------------------------------------
# ◇ 撮影間隔
#--------------------------------------------------------------------------
WAIT = 40
end # module SS
end # module CAO
#/////////////////////////////////////////////////////////////////////////////#
# #
# 下記のスクリプトを変更する必要はありません。 #
# #
#/////////////////////////////////////////////////////////////////////////////#
module CAO::SS
#--------------------------------------------------------------------------
# ●
#--------------------------------------------------------------------------
GetKeyState = Win32API.new('user32', 'GetKeyState', 'i', 'i')
#--------------------------------------------------------------------------
# ●
#--------------------------------------------------------------------------
def self.press_prtscn?
return (GetKeyState.call(0x2C) >> 15) & 1 == 1
end
#--------------------------------------------------------------------------
# ●
#--------------------------------------------------------------------------
def self.mkdir(path)
return if FileTest.directory?(path)
parent = path.split(/[\\\/]/)[0..-2].join('/')
self.mkdir(parent) unless parent.empty? || FileTest.directory?(parent)
Dir.mkdir(path)
end
end
class << Graphics
#--------------------------------------------------------------------------
# ●
#--------------------------------------------------------------------------
@@ss_count = 0
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias _cao_ss_update update
def update
_cao_ss_update
if CAO::SS.press_prtscn? && @@ss_count <= 0
@@ss_count = CAO::SS::WAIT
CAO::SS::FILE_SOUND.play if CAO::SS::FILE_SOUND
save_screen_shot
end
@@ss_count -= 1 if @@ss_count > 0
end
#--------------------------------------------------------------------------
# ● スクリーンショットの保存
#--------------------------------------------------------------------------
def save_screen_shot
filename = Time.now.strftime(CAO::SS::SAVE_NAME)
CAO::SS.mkdir(File.dirname(filename))
bitmap = Graphics.snap_to_bitmap
unless CAO::SS::FILE_LOGO.empty?
logo = Cache.system(CAO::SS::FILE_LOGO)
bitmap.blt(0, 0, logo, logo.rect)
end
bitmap.save_png(filename)
bitmap.dispose
end
end