module Input
  
  RES_KEY = Input::F5
  HWND = Win32API.new('user32', 'GetActiveWindow', nil, 'l').call
  SetWindowPos  = Win32API.new('user32', 'SetWindowPos', 'lliiiii', 'i')
  GetSystemMetrics = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i')
  
  @state = 0
  
  class << self
    alias update_res update
    def update
          set_window($game_variables[x], $game_variables[y])
      update_res
    end
  
    def set_window(w, h)
      x = (GetSystemMetrics.call(0) - w) / 2
      y = (GetSystemMetrics.call(1) - h) / 2
      h += GetSystemMetrics.call(4)
      SetWindowPos.call(HWND, 0, x, y, w, h, 0x0020)
    end
  end
end