hedgewars/uFLUICallback.pas
branchqmlfrontend
changeset 10951 89a7f617e091
child 11832 8c71c5a1172f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hedgewars/uFLUICallback.pas	Thu May 21 00:19:06 2015 +0300
@@ -0,0 +1,32 @@
+unit uFLUICallback;
+interface
+uses uFLTypes;
+
+procedure registerUIMessagesCallback(p: pointer; f: TUICallback); cdecl;
+procedure sendUI(msgType: TMessageType; msg: PChar; len: Longword);
+
+implementation
+uses uFLIPC;
+
+var uiCallbackPointer: pointer;
+    uiCallbackFunction: TUICallback;
+
+procedure engineMessageCallback(p: pointer; msg: PChar; len: Longword);
+begin
+    if len = 128 * 256 then uiCallbackFunction(uiCallbackPointer, mtPreview, msg, len)
+end;
+
+procedure registerUIMessagesCallback(p: pointer; f: TUICallback); cdecl;
+begin
+    uiCallbackPointer:= p;
+    uiCallbackFunction:= f;
+
+    registerIPCCallback(nil, @engineMessageCallback)
+end;
+
+procedure sendUI(msgType: TMessageType; msg: PChar; len: Longword);
+begin
+    uiCallbackFunction(uiCallbackPointer, msgType, msg, len)
+end;
+
+end.