纳金网

标题: Unity3D 调用DLL类库 [打印本页]

作者: 狂风大尉    时间: 2014-6-30 14:41
标题: Unity3D 调用DLL类库


1。将CanmeraDll.dll文件放入根目录

2。编写如下声明代码

  1.     [DllImport("CanmeraDll")]
  2.     public static extern int Net_Cam_Init(ref int CamID, ref int w, ref int h, ref int BFormat);
  3.     [DllImport("CanmeraDll")]
  4.     public static extern IntPtr Net_Cam_GetFrameBuff(ref int Cam, ref int Size);
  5.     [DllImport("CanmeraDll")]
  6.     public static extern int Net_Cam_UnInit();
复制代码

3。调用代码

  1. void Start () {      
  2.   if(NetCamWrapper.Net_Cam_Init(ref Cam_Id, ref wid, ref hig, ref BFormat) == 1){
  3.    NetCamStatus = true;
  4.    Debug.Log("NetCamera Have Init!");      
  5.   }else
  6.    Debug.Log("NetCamera Don't Init!");      
  7. }
复制代码

作者: HIDEOKOJIMA    时间: 2014-6-30 16:02
Thanks for sharing !
作者: wucnj    时间: 2014-7-1 10:53
感谢分享!!!
作者: icerein    时间: 2014-7-1 12:43
感谢分享!!!




欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5