hedgewars/uFLUICallback.pas
author unc0rr
Thu, 17 Dec 2015 00:51:20 +0300
branchqmlfrontend
changeset 11459 30397f91571c
parent 10951 89a7f617e091
child 11827 8c71c5a1172f
permissions -rw-r--r--
Fix a ton of bugs in engine instances queue and ipc

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.