Project1

标题: 看吧 [打印本页]

作者: 幻域三影    时间: 2011-7-1 19:52
标题: 看吧
本帖最后由 幻域三影 于 2011-7-1 19:53 编辑

调分辨率用这个,不过有点漏洞啊·····



# ————————————————————————————————————
# 分辨率放大
# ————————————————————————————————————

class Win32API
  GAME_INI_FILE = ".\\Game.ini"
  HWND_TOPMOST = 0
  HWND_TOP = -1
  SWP_NOMOVE   = 0
  SWP_FRAMECHANGED = 0
  HWND_NOTTOPMOST = 0
  WM_GETMINMAXINFO = 24
  #——————————————————————————————————————
  def Win32API.GetPrivateProfileString(section, key)
    val = "\0"*256
    gps = Win32API.new('kernel32', 'GetPrivateProfileString',%w(p p p p l p), 'l')
    gps.call(section, key, "", val, 256, GAME_INI_FILE)
    val.delete!("\0")
    return val
  end
  #——————————————————————————————————————
  def Win32API.FindWindow(class_name, title)
    fw = Win32API.new('user32', 'FindWindow', %(p, p), 'i')
    hWnd = fw.call(class_name, title)
    return hWnd
  end
  #——————————————————————————————————————
  def Win32API.SetWindowPos(w, h)
    title =  Win32API.GetPrivateProfileString("Game", "Title")
    hWnd = Win32API.FindWindow("RGSS Player", title)
    swp = Win32API.new('user32', 'SetWindowPos', %(l, l, i, i, i, i, i), 'i')
    win = swp.call(hWnd, HWND_TOP, -3, -22,  w + 6, h+32, WM_GETMINMAXINFO)
    return win
  end
  #——————————————————————————————————————
  def Win32API.client_size
    title =  Win32API.GetPrivateProfileString("Game", "Title")
    hWnd = Win32API.FindWindow("RGSS Player", title)
    rect = [0, 0, 0, 0].pack('l4')
    Win32API.new('user32', 'GetClientRect', %w(l p), 'i').call(hWnd, rect)
    width, height = rect.unpack('l4')[2..3]
    return width, height
  end
end
$width = 1024
$height = 768
win = Win32API.SetWindowPos($width, $height)
if(win == 0)
  p "Size change has failed!"
end





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