hedgewars/uFLUICallback.pas
branchqmlfrontend
changeset 10951 89a7f617e091
child 11832 8c71c5a1172f
equal deleted inserted replaced
10949:6a1f5f452460 10951:89a7f617e091
       
     1 unit uFLUICallback;
       
     2 interface
       
     3 uses uFLTypes;
       
     4 
       
     5 procedure registerUIMessagesCallback(p: pointer; f: TUICallback); cdecl;
       
     6 procedure sendUI(msgType: TMessageType; msg: PChar; len: Longword);
       
     7 
       
     8 implementation
       
     9 uses uFLIPC;
       
    10 
       
    11 var uiCallbackPointer: pointer;
       
    12     uiCallbackFunction: TUICallback;
       
    13 
       
    14 procedure engineMessageCallback(p: pointer; msg: PChar; len: Longword);
       
    15 begin
       
    16     if len = 128 * 256 then uiCallbackFunction(uiCallbackPointer, mtPreview, msg, len)
       
    17 end;
       
    18 
       
    19 procedure registerUIMessagesCallback(p: pointer; f: TUICallback); cdecl;
       
    20 begin
       
    21     uiCallbackPointer:= p;
       
    22     uiCallbackFunction:= f;
       
    23 
       
    24     registerIPCCallback(nil, @engineMessageCallback)
       
    25 end;
       
    26 
       
    27 procedure sendUI(msgType: TMessageType; msg: PChar; len: Longword);
       
    28 begin
       
    29     uiCallbackFunction(uiCallbackPointer, msgType, msg, len)
       
    30 end;
       
    31 
       
    32 end.