Does bbSetBlitz3DEventCallback actually work (C#)
Archives Forums/Blitz3D SDK Programming/Does bbSetBlitz3DEventCallback actually work (C#)
| ||
Hi all, I having been scratching my head and trying everything I can think of to get this callback working under C#. But, I have no joy at all. Has anybody else managed to get this working. I know it must use a delegate which is assigned a handler, then this is passed into the SDK, but nothing I do seems to work plus I don't get any errors. Thanks in advance. |
| ||
Ok, I have found the way to do it. I have posted the code just in case anybody else is stuck. Delegate Declaration: [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate int dBBEventHandler(int hWnd, int Msg, int wParam, int lParam); public dBBEventHandler BBEventHandler; Assigning the handler to the SDK: BBEventHandler = new dBBEventHandler(Engine_BBEventHandler); bb.SetBlitz3DEventCallback(Marshal.GetFunctionPointerForDelegate(BBEventHandler).ToInt32()); Obviously you need to use System.Runtime.InteropServices |