#encoding:utf-8
#==============================================================================
# ■ VA - Screenshot by LBQ
# - based on Bitmap2PNG by Dant
#------------------------------------------------------------------------------
# Bitmap2PNG is Required: http://rpg.blue/thread-224347-1-1.html
#==============================================================================
# Almost all the hard work has been done by Dant.
#------------------------------------------------------------------------------
# Usage: Press Screenshot Key (Default: D) to Take Screenshot
# - Default saved in Screenshots Directory
#==============================================================================
module LBQ
module Screenshot
$imported ||= {}
$imported[:lbq_screenshot] = '0.9'
# :Button Default Keyboard Button
# :L Q
# :R W
# :X A
# :Y S
# :Z D
KEY = :Z # Default: Z which is D on keyboard
MSGBOX = true # Weather to play a sound or not
FOLDER = "Screenshots"
#if only time is enabled, the filename will only be composed of the time
ONLY_TIME = false
MSG = proc do
Sound.play_shop
puts "SCREENSHOT SAVED"
end # proc
end
end
class << LBQ::Screenshot
def check_screenshot
if Bitmap.instance_methods.include?(:save_png)
puts "LBQ - Screenshot: Found :save_png Method"
else
msgbox <<-INFO
LBQ - Screenshot Cannot Find :save_png Method for Bitmap
Please Make Sure that You Have Bitmap2PNG by Dant
You can find the download link for Bitmap2PNG in the Comments
of the scripts
INFO
end
end
def take_screenshot
check_screenshot
Dir.mkdir(LBQ::Screenshot::FOLDER) unless Dir.exist?(LBQ::Screenshot::FOLDER)
File.new get_filename, "w"
Graphics.snap_to_bitmap.save_png(get_filename)
LBQ::Screenshot::MSG.call if LBQ::Screenshot::MSGBOX
end # def take_screenshot
def get_filename
return "#{LBQ::Screenshot::FOLDER}/Screenshot-#{Time.now.strftime("%I_%M_%S")}.png" if LBQ::Screenshot::ONLY_TIME
if SceneManager.scene_is?(Scene_Map)
n = "Map - #{$game_map.display_name}"
elsif SceneManager.scene_is?(Scene_Battle)
n = "Battle - #{$game_troop.troop.name}"
elsif SceneManager.scene_is?(Scene_Shop)
n = "Shop"
else
n = SceneManager.scene.class.name
end # SceneMap
n.gsub!(/[\x00\/\\:\*\?\"<>\|]/, '_')
return "#{LBQ::Screenshot::FOLDER}/#{n}-#{Time.now.strftime("%I_%M_%S")}.png"
end # def get_filename
end
class Scene_Base
alias :lbq_screenshot_scene_base_update :update
def update
lbq_screenshot_scene_base_update
LBQ::Screenshot.take_screenshot if Input.trigger?(LBQ::Screenshot::KEY)
end
end