Project1

标题: 按F8鍵截圖。。 [打印本页]

作者: 忻緣    时间: 2008-9-12 04:18
标题: 按F8鍵截圖。。
這個是按shift截圖的。。想改成按F8截圖。。-A-順便想讓截圖存到自己新建的Pic文件下。。
  1. #============================================================================== #
  2. # Screenshot V2
  3. #
  4. # Screenshot Script v1 & screenshot.dll v1            created by: Andreas21
  5. # Screenshot Script v2                                created/edit by: cybersam
  6. # the autor is found on a german board...
  7. # the comments are added by me...
  8. # since the autor didnt want to add any comment...
  9. # so thats it from here...
  10. # have fund with it... ^-^
  11. #
  12. # oh yea.. the needed command line is found in "Scene_Map" in "def update"
  13. #
  14. #===============================================================================
  15. module Screen  
  16.   @screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
  17.   @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
  18.   @findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
  19.   module_function
  20.   #-----------------------------------------------------------------------------
  21.   # here comes the stuff...
  22.   # i add here the stuff for automatic change of the number for the screenshot
  23.   # so it wont overrite the old one...
  24.   # if you want to change so stuff change them in this line below
  25.   # or you can change them in your command line... like
  26.   # Screen::shot("screenshot", 2)
  27.   # this change the name and the type of the screenshot
  28.   # (0 = bmp, 1 = jpg and 2 = png)
  29.   # ----------------------------------------------------------------------------
  30.   def shot(file = "screenshot", typ = 2)
  31.     # to add the right extension...
  32.     if typ == 0
  33.       typname = ".bmp"
  34.     elsif typ == 1
  35.       typname = ".jpg"
  36.     elsif typ == 2
  37.       typname = ".png"
  38.     end   
  39.     file_index = 0   
  40.     dir = ""   
  41.     # make the filename....
  42.     file_name = file.to_s + typname.to_s#dir + file.to_s + typname.to_s   
  43.     # make the screenshot.... Attention dont change anything from here on....
  44.     @screen.call(0,0,640,480,file_name,handel,typ)
  45.   end
  46.   # find the game window...
  47.   def handel
  48.     game_name = "\0" * 256
  49.     @readini.call('Game','Title','',game_name,255,".\\Game.ini")
  50.     game_name.delete!("\0")
  51.     return @findwindow.call('RGSS Player',game_name)
  52.   end
  53. end


  54. #==============================================================================
  55. # ■ Graphics
  56. #------------------------------------------------------------------------------
  57. #  進行有關全體圖像處理的模塊。
  58. #==============================================================================

  59. class << Graphics
  60.   alias old_update update
  61.   #--------------------------------------------------------------------------
  62.   # ● 更新畫面
  63.   #--------------------------------------------------------------------------
  64.   def update
  65.     if Input.press?(Input::SHIFT)
  66.       timestamp = Time.now.strftime("%Y%m%d%H%M")
  67.       se = Time.now.sec
  68.       Screen::shot("#{timestamp}#{se}", 2)
  69.     end
  70.     old_update
  71.   end
  72. end
复制代码
[LINE]1,#dddddd[/LINE]版务信息:本贴由楼主自主结贴~
作者: Tabris_Air    时间: 2008-9-12 16:26
    if Input.press?(Input::SHIFT)

把里面的SHIFT改改看看,至于是不是该成F8就是F8那不清楚= =

    dir = ""  

这个里面加入路径即可 [LINE]1,#dddddd[/LINE]系统信息:本贴获得楼主认可,66RPG感谢您的热情解答~
作者: 轮回者    时间: 2008-9-12 20:37
LS正解
将Input.press?(Input::SHIFT)改为Input.press?(Input::F8) [LINE]1,#dddddd[/LINE]系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1