赞 | 0 |
VIP | 0 |
好人卡 | 1 |
积分 | 0 |
经验 | 4319 |
最后登录 | 2013-1-29 |
在线时间 | 152 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 49
- 在线时间
- 152 小时
- 注册时间
- 2012-1-12
- 帖子
- 456
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 无双sxa 于 2012-4-19 18:24 编辑
我不是原创的,作者还没有找到,不加分也可以,我只是义务搬运劳动而已,助人为乐嘛。- #==============================================================================
- # ■ VXAce-RGSS3-18 ギャラリー by Claimh
- #------------------------------------------------------------------------------
- # 写真を表示するギャラリーを作ります
- # なお、ギャラリーの管理情報は全セーブデータで共通となります。
- #------------------------------------------------------------------------------
- # ●ギャラリー全体の表示許可
- # DataManager.garally.enable = true
- # ●写真の表示許可
- # DataManager.garally[id] = true
- # ●写真の追加(LIST以外のスナップショットなどを追加)
- # DataManager.garally.push(id, GFile.new(filename, text))
- # ●イベント等から呼び出す
- # SceneManager.call(Scene_ExGarally)
- #==============================================================================
- class GFile
- attr_reader :name
- attr_reader :text
- def initialize(filename, text="")
- @name = filename; @text = text
- end
- end
- module ExGarally
- # 写真の設定
- LIST = {
- # ID => GFile.new("ファイル名(Graphics/Pictures)", 表示文字)
- 1 => GFile.new("BlueSky", "青い空\n改行"),
- 2 => GFile.new("CloudySky1", "曇った空"),
- 3 => GFile.new("CloudySky2"),
- 4 => GFile.new("DarkSpace1"),
- 5 => GFile.new("DarkSpace2"),
- 6 => GFile.new("Mountains1"),
- 7 => GFile.new("Mountains2"),
- 8 => GFile.new("Mountains3"),
- 9 => GFile.new("Mountains4"),
- 10 => GFile.new("Mountains5"),
- 12 => GFile.new("Ocean2"),
- 11 => GFile.new("Ocean1"),
- 13 => GFile.new("SeaofClouds"),
- 14 => GFile.new("StarlitSky"),
- # 15 => GFile.new("Sunset"),
- }
-
- # ヘルプウィンドウの行数(1~3)
- HELP_LINES = 2
- end
- #==============================================================================
- # ■ ExGarally
- #==============================================================================
- module ExGarally
- #--------------------------------------------------------------------------
- # ● ギャラリーの表示有効?
- #--------------------------------------------------------------------------
- def self.enable?
- DataManager.garally.enable
- end
- #--------------------------------------------------------------------------
- # ● ファイル名
- #--------------------------------------------------------------------------
- def self.filename
- "exgallary.rvdata2"
- end
- #--------------------------------------------------------------------------
- # ● セーブの実行
- #--------------------------------------------------------------------------
- def self.save_exdata(obj)
- save_data(obj, filename)
- end
- #--------------------------------------------------------------------------
- # ● ロードの実行
- #--------------------------------------------------------------------------
- def self.load_exdata
- exist? ? load_data(filename) : Game_ExGarallyList.new
- end
- #--------------------------------------------------------------------------
- # ● ファイル削除
- #--------------------------------------------------------------------------
- def self.delete_exdata
- return unless exist?
- File.delete(filename) rescue nil
- end
- #--------------------------------------------------------------------------
- # ● ファイルの有無チェック
- #--------------------------------------------------------------------------
- def self.exist?
- FileTest.exist?(filename)
- end
- end
- #==============================================================================
- # ■ DataManager
- #==============================================================================
- class << DataManager
- #--------------------------------------------------------------------------
- # ● 各種ゲームオブジェクトの作成
- #--------------------------------------------------------------------------
- alias create_game_objects_exgrly create_game_objects
- def create_game_objects
- create_game_objects_exgrly
- load_garally
- end
- #--------------------------------------------------------------------------
- # ● セーブの実行
- #--------------------------------------------------------------------------
- alias save_game_exgarally save_game
- def save_game(index)
- r = save_game_exgarally(index)
- save_garally if r
- r
- end
- #--------------------------------------------------------------------------
- # ● ロードの実行
- #--------------------------------------------------------------------------
- alias load_game_exgrly load_game
- def load_game(index)
- r = load_game_exgrly(index)
- load_garally if r
- r
- end
- #--------------------------------------------------------------------------
- # ● ギャラリー情報load
- #--------------------------------------------------------------------------
- def load_garally
- @exgarally = ExGarally.load_exdata
- end
- #--------------------------------------------------------------------------
- # ● ギャラリー情報load
- #--------------------------------------------------------------------------
- def save_garally
- ExGarally.save_exdata(@exgarally)
- end
- #--------------------------------------------------------------------------
- # ● ギャラリー情報削除
- #--------------------------------------------------------------------------
- def delete_garally
- ExGarally.delete_exdata
- load_garally
- end
- #--------------------------------------------------------------------------
- # ● ギャラリー情報参照
- #--------------------------------------------------------------------------
- def garally
- @exgarally
- end
- end
- #==============================================================================
- # ■ Game_ExGarally
- #==============================================================================
- class Game_ExGarally
- attr_accessor :name # ファイル名
- attr_accessor :text # 表示文字
- attr_accessor :enable # 表示可否
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(file, enable=false)
- @name = file.name
- @text = file.text
- @enable = enable
- end
- end
- #==============================================================================
- # ■ Game_ExGarallyList : DataManager.garallyで参照可能
- #==============================================================================
- class Game_ExGarallyList
- LIST = ExGarally::LIST
- attr_accessor :enable
- attr_reader :size
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- clear
- end
- #--------------------------------------------------------------------------
- # ● クリア
- #--------------------------------------------------------------------------
- def clear
- @size = LIST.size
- @data = {}
- @enable = false
- end
- #--------------------------------------------------------------------------
- # ● 参照
- #--------------------------------------------------------------------------
- def [](id)
- return nil if LIST[id].nil? and @data[id].nil?
- return Game_ExGarally.new(LIST[id]) if @data[id].nil?
- @data[id]
- end
- #--------------------------------------------------------------------------
- # ● 表示許可/禁止
- #--------------------------------------------------------------------------
- def []=(id, val)
- return nil if LIST[id].nil? and @data[id].nil?
- if val
- @data[id] = Game_ExGarally.new(LIST[id]) if @data[id].nil?
- @data[id].enable = true
- elsif !@data[id].nil?
- @data.delete(id)
- end
- end
- #--------------------------------------------------------------------------
- # ● リスト
- #--------------------------------------------------------------------------
- def list
- (@data.keys+LIST.keys).uniq.sort.collect {|id| self.[](id) }
- end
- #--------------------------------------------------------------------------
- # ● 追加ギャラリー
- #--------------------------------------------------------------------------
- def push(id, name, enable=true)
- @data[id] = Game_ExGarally.new(name, enable)
- @size += 1 if LIST[id].nil?
- end
- end
- #==============================================================================
- # ■ Sprite_ExGrlyPicture
- #==============================================================================
- class Sprite_ExGrlyPicture < Sprite
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(rect=Rect.new(0,0,Graphics.width,Graphics.height))
- super(Viewport.new(rect))
- viewport.z = 100
- create_bitmap
- end
- #--------------------------------------------------------------------------
- # ● オブジェクト解放
- #--------------------------------------------------------------------------
- def dispose
- dispose_bitmap
- super
- end
- #--------------------------------------------------------------------------
- # ● ビットマップ生成
- #--------------------------------------------------------------------------
- def create_bitmap
- self.bitmap = Bitmap.new(vw, vh)
- end
- #--------------------------------------------------------------------------
- # ● ビットマップ下方
- #--------------------------------------------------------------------------
- def dispose_bitmap
- self.bitmap.dispose
- end
- #--------------------------------------------------------------------------
- # ● ピクチャ設定
- #--------------------------------------------------------------------------
- def picture(filename, enabled=true)
- dispose_bitmap
- if enabled
- self.bitmap = Cache.picture(filename)
- else
- create_bitmap
- self.bitmap.fill_rect(0,0,vw,vh,Color.new(0,0,0,160))
- # self.bitmap.draw_text(0,0, vw, vh, filename, 1)
- end
- fit_screen
- resize
- end
- #--------------------------------------------------------------------------
- # ● ズーム倍率再設定
- #--------------------------------------------------------------------------
- def resize(r=Rect.new(0,0,vw,vh))
- self.ox = bitmap.width / 2
- self.oy = bitmap.height / 2
- self.x = r.width / 2 + r.x
- self.y = r.height / 2 + r.y
- end
- #--------------------------------------------------------------------------
- # ● 画面にフィットさせる
- #--------------------------------------------------------------------------
- def bwz; (bitmap.width * zoom_x).truncate; end # ズーム後のbitmap幅
- def bhz; (bitmap.height* zoom_y).truncate; end # ズーム後のbitmap高さ
- def vw; viewport.rect.width; end
- def vh; viewport.rect.height; end
- def fit_screen(w=vw, h=vh)
- x_zoom = w * 1.0 / bitmap.width
- y_zoom = h * 1.0 / bitmap.height
- zoom = x_zoom < y_zoom ? x_zoom : y_zoom
- self.zoom_x = self.zoom_y = zoom
- end
- end
- #==============================================================================
- # ■ Sprite_ExGrlyPicture
- #==============================================================================
- class Sprite_ExGrlyPictFull < Sprite_ExGrlyPicture
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super
- hide.viewport.z = 200
- end
- #--------------------------------------------------------------------------
- # ● ウィンドウの表示
- #--------------------------------------------------------------------------
- def show
- self.visible = true
- self
- end
- #--------------------------------------------------------------------------
- # ● ウィンドウの非表示
- #--------------------------------------------------------------------------
- def hide
- self.visible = false
- self
- end
- #--------------------------------------------------------------------------
- # ● ピクチャ設定
- #--------------------------------------------------------------------------
- def picture(filename, enabled=true)
- dispose_bitmap
- b = Cache.picture(filename)
- r = Rect.new(0, 0, b.width, b.height)
- self.bitmap = Bitmap.new(r.width, r.height)
- self.bitmap.stretch_blt(r, b, r)
- fit_screen
- resize
- end
- end
- #==============================================================================
- # ■ Grly_Thumbnail
- #==============================================================================
- class Grly_Thumbnail
- attr_reader :item
- attr_reader :rect
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(item, rect)
- @item = item; @rect = rect
- end
- end
- #==============================================================================
- # ■ SpritesetExGrlyPictures
- #==============================================================================
- class SpritesetExGrlyPictures
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- @sprites = []
- end
- #--------------------------------------------------------------------------
- # ● オブジェクト解放
- #--------------------------------------------------------------------------
- def dispose
- dispose_sprites
- end
- #--------------------------------------------------------------------------
- # ● ピクチャスプライト生成
- #--------------------------------------------------------------------------
- def create_sprites(thumnails)
- thumnails.each do |thm|
- s = Sprite_ExGrlyPicture.new(thm.rect)
- s.picture(thm.item.name, thm.item.enable)
- @sprites.push(s)
- end
- end
- #--------------------------------------------------------------------------
- # ● ピクチャスプライト解放
- #--------------------------------------------------------------------------
- def dispose_sprites
- @sprites.each { |s| s.dispose }
- end
- #--------------------------------------------------------------------------
- # ● ピクチャスプライト更新
- #--------------------------------------------------------------------------
- def update_sprites(thumnails)
- dispose_sprites
- create_sprites(thumnails)
- end
- #--------------------------------------------------------------------------
- # ● サムネイル矩形
- #--------------------------------------------------------------------------
- def thm_rect(i)
- @sprites[i].nil? ? nil : @sprites[i].thm
- end
- end
- #==============================================================================
- # ■ Window_GrlyPicture
- #==============================================================================
- class Window_GrlyPicture < Window_Selectable
- attr_accessor :thum_sprites
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- @thum_sprites = nil
- make_list
- super(0, help_height, Graphics.width, Graphics.height-help_height)
- activate
- end
- #--------------------------------------------------------------------------
- # ● ヘルプウィンドウの高さ
- #--------------------------------------------------------------------------
- def help_height
- fitting_height(ExGarally::HELP_LINES)
- end
- #--------------------------------------------------------------------------
- # ● 桁数の取得
- #--------------------------------------------------------------------------
- def col_max
- return 3
- end
- #--------------------------------------------------------------------------
- # ● 横に項目が並ぶときの空白の幅を取得
- #--------------------------------------------------------------------------
- def spacing
- return 16
- end
- #--------------------------------------------------------------------------
- # ● 項目数の取得
- #--------------------------------------------------------------------------
- def item_max
- DataManager.garally.size
- end
- #--------------------------------------------------------------------------
- # ● 項目の高さを取得
- #--------------------------------------------------------------------------
- def item_height
- (Graphics.height - help_height - standard_padding * 2) / 2
- end
- #--------------------------------------------------------------------------
- # ● 項目を描画する矩形の取得
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = super(index)
- thm = calc_thm_rect
- rect.x += (rect.width - (thm.width + 8)) / 2
- rect.y += (rect.height - (thm.height + 8)) / 2
- rect.width = thm.width + 8
- rect.height = thm.height + 8
- rect
- end
- #--------------------------------------------------------------------------
- # ● サムネイル矩形計算
- #--------------------------------------------------------------------------
- def calc_thm_rect
- r = Rect.new
- r.width = item_width - 8
- r.height = item_height - 8
- if (Graphics.width / r.width) > (Graphics.height / r.height)
- r.height = r.width * Graphics.height / Graphics.width
- else
- r.width = r.height * Graphics.width / Graphics.height
- end
- r
- end
- #--------------------------------------------------------------------------
- # ● サムネイルの表示位置を取得
- #--------------------------------------------------------------------------
- def thum_rect(index)
- r = item_rect_for_text(index)
- r.x += self.x + standard_padding
- r.y += self.y + standard_padding
- r
- end
- #--------------------------------------------------------------------------
- # ● 先頭行のindex
- #--------------------------------------------------------------------------
- def top_i
- (top_row * col_max)
- end
- #--------------------------------------------------------------------------
- # ● 先頭行からの@index
- #--------------------------------------------------------------------------
- def top_cur_i
- (@index - (top_row * col_max))
- end
- #--------------------------------------------------------------------------
- # ● サムネイルの表示位置を取得
- #--------------------------------------------------------------------------
- def thumnails
- n = [page_item_max, item_max - top_i].min
- idxs = []
- n.times { |i| idxs.push(i) }
- idxs.collect { |i| Grly_Thumbnail.new(@list[i+top_i], thum_rect(i)) }
- end
- #--------------------------------------------------------------------------
- # ● リスト生成
- #--------------------------------------------------------------------------
- def make_list
- @list = DataManager.garally.list
- end
- #--------------------------------------------------------------------------
- # ● 選択中アイテム
- #--------------------------------------------------------------------------
- def item
- @list[@index]
- end
- #--------------------------------------------------------------------------
- # ● 選択項目の有効状態を取得
- #--------------------------------------------------------------------------
- def current_item_enabled?
- !item.nil? and item.enable
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def update_help
- text = ((!item.nil? and item.enable) ? item.text : "")
- @help_window.set_text(text)
- end
- #--------------------------------------------------------------------------
- # ● カーソルの更新
- #--------------------------------------------------------------------------
- def update_cursor
- super
- @thum_sprites.update_sprites(thumnails) unless @thum_sprites.nil?
- end
- end
- #==============================================================================
- # ■ Scene_ExGarally
- #==============================================================================
- class Scene_ExGarally < Scene_Base
- #--------------------------------------------------------------------------
- # ● 開始処理
- #--------------------------------------------------------------------------
- def start
- super
- create_background
- @help_window = Window_Help.new(ExGarally::HELP_LINES)
- @thumset = SpritesetExGrlyPictures.new
- @full_pict = Sprite_ExGrlyPictFull.new
- create_list_window
- end
- #--------------------------------------------------------------------------
- # ● 終了処理
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_background
- @thumset.dispose
- @full_pict.dispose
- end
- #--------------------------------------------------------------------------
- # ● 背景の作成
- #--------------------------------------------------------------------------
- def create_background
- @background_sprite = Sprite.new
- @background_sprite.bitmap = SceneManager.background_bitmap
- @background_sprite.color.set(16, 16, 16, 128)
- end
- #--------------------------------------------------------------------------
- # ● 背景の解放
- #--------------------------------------------------------------------------
- def dispose_background
- @background_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # ● ピクチャリストウィンドウ生成
- #--------------------------------------------------------------------------
- def create_list_window
- @list_window = Window_GrlyPicture.new
- @list_window.thum_sprites = @thumset
- @list_window.help_window = @help_window
- set_full_handler
- @list_window.select(0)
- end
- #--------------------------------------------------------------------------
- # ● フルスクリーン化用のハンドラ登録
- #--------------------------------------------------------------------------
- def set_full_handler
- @list_window.set_handler(:ok, method(:cmd_full))
- @list_window.set_handler(:cancel, method(:return_scene))
- end
- #--------------------------------------------------------------------------
- # ● サムネイルリスト用のハンドラ登録
- #--------------------------------------------------------------------------
- def set_thum_handler
- @list_window.set_handler(:ok, method(:cmd_thum))
- @list_window.set_handler(:cancel, method(:cmd_thum))
- end
- #--------------------------------------------------------------------------
- # ● フルスクリーン化
- #--------------------------------------------------------------------------
- def cmd_full
- Graphics.freeze
- @full_pict.show.picture(@list_window.item.name)
- perform_transition
- set_thum_handler
- @list_window.activate.cursor_fix = true
- end
- #--------------------------------------------------------------------------
- # ● サムネイル化
- #--------------------------------------------------------------------------
- def cmd_thum
- Graphics.freeze
- @full_pict.hide
- perform_transition
- set_full_handler
- @list_window.activate.cursor_fix = false
- end
- end
- module Title
- # 拡張コマンドへ追加
- EXCMD[3] = ["画廊", Scene_ExGarally, :garally]
- # コマンド画像ファイル(Graphics/System)
- # CMD_GRPHIC[コマンド番号] [画像1, 画像2]
- CMD_GRPHIC[3] = ["garally", "garally_s"]
- end
- #==============================================================================
- # ■ Scene_ExGarally
- #==============================================================================
- class Scene_ExGarally < Scene_Base
- #--------------------------------------------------------------------------
- # ● 呼び出し元のシーンへ戻る
- #--------------------------------------------------------------------------
- def return_scene
- super
- return unless SceneManager.scene_is?(Scene_Title)
- SceneManager.scene.prepare(Title::Scene::S_TITLE, false,
- Title::CMD_BOX.index(3))
- end
- end
- #==============================================================================
- # ■ Scene_Title
- #==============================================================================
- class Scene_Title < Scene_Base
- #--------------------------------------------------------------------------
- # ● メイン
- #--------------------------------------------------------------------------
- alias main_reload main
- def main
- DataManager.load_garally # ギャラリーのリロード
- main_reload
- end
- end
复制代码- #==============================================================================
- # ■ VXAce-RGSS3-18 ギャラリー in Menu by Claimh
- #------------------------------------------------------------------------------
- # メニューコマンドに拡張コマンド[ギャラリー]を追加します。
- #==============================================================================
- #==============================================================================
- # ■ Window_MenuCommand
- #==============================================================================
- class Window_MenuCommand < Window_Command
- #--------------------------------------------------------------------------
- # ● 独自コマンドの追加用
- #--------------------------------------------------------------------------
- alias add_original_commands_exgarally add_original_commands
- def add_original_commands
- add_original_commands_exgarally
- add_command("画廊", :garally, ExGarally.enable?) if ExGarally.enable?
- end
- end
- #==============================================================================
- # ■ Scene_Menu
- #==============================================================================
- class Scene_Menu < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ● コマンドウィンドウの作成
- #--------------------------------------------------------------------------
- alias create_command_window_dictionary create_command_window
- def create_command_window
- create_command_window_dictionary
- @command_window.set_handler(:garally, method(:command_garally))
- end
- #--------------------------------------------------------------------------
- # ● コマンド[ギャラリー]
- #--------------------------------------------------------------------------
- def command_garally
- SceneManager.call(Scene_ExGarally)
- end
- end
复制代码 有画廊肯定有保存图片- # coding: utf-8
- #===============================================================================
- # ■ 遅延型スクリーンショット撮影さん for RGSS3
- #-------------------------------------------------------------------------------
- # 2012/01/07 Ru/むっくRu
- #-------------------------------------------------------------------------------
- # PrintScreenを押すと指定フォルダに
- # ゲーム画面のスクリーンショットを保存する機能を追加します
- # (処理落ち対策として,押してから数秒後にファイルが生成されます)
- #-------------------------------------------------------------------------------
- # 【問題点など】
- # 保存の際にゲームのフレームレートが少し落ちます(処理落ち)
- #-------------------------------------------------------------------------------
- # 【更新履歴】
- # 2012/01/07 戦闘中にうまく撮影できないのを修正?
- # 2011/12/27 ぶっぱ
- #-------------------------------------------------------------------------------
- # 【参考:PNG画像生成処理】
- # http://d.hatena.ne.jp/ku-ma-me/20091003/p1
- #-------------------------------------------------------------------------------
- #===============================================================================
- # ● 設定項目
- #==============================================================================
- module HZM_VXA
- module ScreenShot
- # 保存するフォルダ名(末尾に/は付けない)
- DIRNAME = 'screenshot'
- # 保存するファイル名.拡張子(.png)は不要
- # %Y …… 西暦
- # %m …… 月(01-12)
- # %d …… 日(01-31)
- # %H …… 時(00-23)
- # %M …… 分(00-59)
- # %S …… 秒(00-59)
- FILENAME = "%Y%m%d_%H%M%S"
-
- # スクリーンショットに著作表示を入れる
- # true …… 入れる
- # false …… 入れない
- USE_COPYRIGHT = false
- # 著作表示の文字
- COPYRIGHT_TEXT = '(C) 鳥小屋.txt'
- # 著作表示の色
- COPYRIGHT_COLOR = Color.new(255, 255, 255)
- # 著作表示の大きさ
- COPYRIGHT_SIZE = 16
- # 著作表示の位置(0:左寄せ,1:中央寄せ,2:右寄せ)
- COPYRIGHT_ALIGN = 2
-
- # 1フレームに処理する回数
- # ※この値を増やすとファイルが生成されるまでの時間が短くなりますが,
- # 一度にかかる負荷量も増えるため,処理落ちが激しくなります
- RUN_SPEED = 3
- end
- end
- #===============================================================================
- # ↑ ここまで設定 ↑
- # ↓ 以下、スクリプト部 ↓
- #===============================================================================
- module HZM_VXA
- module ScreenShot
- @pressed = false
- @list = []
- VK_SNAPSHOT = 0x2c
- GetKeyState = Win32API.new('user32', 'GetKeyState', %w(l), 'i')
- #---------------------------------------------------------------------------
- # ● 更新
- #---------------------------------------------------------------------------
- def self.update
- add if press?
- RUN_SPEED.times { develop }
- end
- #---------------------------------------------------------------------------
- # ● PrintScreen監視
- #---------------------------------------------------------------------------
- def self.press?
- if @pressed
- @pressed = (GetKeyState.call(VK_SNAPSHOT) < 0)
- false
- else
- @pressed = (GetKeyState.call(VK_SNAPSHOT) < 0)
- end
- end
- #---------------------------------------------------------------------------
- # ● 今の画面を現像待ちに追加
- #---------------------------------------------------------------------------
- def self.add
- bitmap = Graphics.snap_to_bitmap
- if USE_COPYRIGHT
- bitmap.font.size = COPYRIGHT_SIZE
- bitmap.font.color = COPYRIGHT_COLOR
- bitmap.draw_text(0, bitmap.height - COPYRIGHT_SIZE, bitmap.width, COPYRIGHT_SIZE, COPYRIGHT_TEXT, COPYRIGHT_ALIGN)
- end
- filename = "#{Time.now.getlocal.strftime(FILENAME)}"
- @list.push({
- :bitmap => bitmap,
- :filename => filename
- })
- end
- #---------------------------------------------------------------------------
- # ● 現像処理
- #---------------------------------------------------------------------------
- def self.develop
- return if @list.empty?
- data = @list.first
- if data[:line] == nil # 未処理
- data[:line] = 0
- data[:img] = []
- elsif data[:line] < data[:bitmap].height # 解析中
- data[:img].push 0
- for i in 0...data[:bitmap].width
- c = data[:bitmap].get_pixel(i, data[:line])
- data[:img].push(c.red, c.green, c.blue)
- end
- data[:line] += 1
- else # 保存処理
- Dir.mkdir(DIRNAME) unless File.exist?(DIRNAME)
- cnt = Dir.glob("#{DIRNAME}/#{data[:filename]}*.png").size
- footer = cnt > 0 ? "_#{cnt}" : ""
- File.open("#{DIRNAME}/#{data[:filename]}#{footer}.png", 'wb') do |file|
- file.write "\x89PNG\r\n\x1a\n"
- file.write createChunk('IHDR', [data[:bitmap].width, data[:bitmap].height, 8, 2, 0, 0, 0].pack('N2C5'))
- file.write createChunk('IDAT', Zlib::Deflate.deflate(data[:img].pack('C*')))
- file.write createChunk('IEND', '')
- end
- data[:bitmap].dispose
- @list.shift
- end
- end
- #---------------------------------------------------------------------------
- # ● PNGチャンク作成
- #---------------------------------------------------------------------------
- def self.createChunk(type, data)
- [data.bytesize, type, data, Zlib.crc32(type + data)].pack('NA4A*N')
- end
- end
- end
- class Scene_Base
- #-----------------------------------------------------------------------------
- # ● フレーム更新(基本)(エイリアス)
- #-----------------------------------------------------------------------------
- alias hzm_vxa_screenshot_update_basic update_basic
- def update_basic
- hzm_vxa_screenshot_update_basic
- HZM_VXA::ScreenShot.update
- end
- end
复制代码 ’’
源地址:http://www4.plala.or.jp/findias/ ... -garally/index.html
作者:Claimh
|
评分
-
查看全部评分
|