//uruchamia grę, przyjmuje strukturę callBacków i dane inicjalizacyjne static public void runProgram(InitData initData) { if (dllExports.call_msg == null || dllExports.call_getCoords == null || dllExports.call_enterPlannerMode == null) { throw new InvalidOperationException("Necessary callback uninitialized"); } else { DllImports.runProgram(initData, dllExports.callBacks); } }
static void Main(string[] args) { DllInterface.setCall_msg(fun_msg); DllInterface.setCall_enterPlannerMode(fun_enterPlannerMode); DllInterface.setCall_getCoords(fun_getCoords); DllInterface.setEvent_boardCreated(fun_boardCreated); DllInterface.setEvent_playerMoved(fun_playerMoved); InitData initData = new InitData { player1type = PlayerType.HUMAN, player2type = PlayerType.AI }; DllInterface.runProgram(initData); }
public static extern void runProgram(InitData initData, CallBacks callBacks);