///////////////////////////////////////////////////////////////////////
// Copyright (C) Andru 2007                                          //
// mail: dr.andru@gmail.com                                          //
// site: http://andru.2x4.ru                                         //
//                                                                   //
// OMEGA Engine is free software.                                    //
//                                                                   //
// You may redistribute it and/or modify it under the terms of the   //
// GNU General Public License, as published by the Free Software     //
// Foundation; either version 2 of the License, or (at your option)  //
// any later version.                                                //
//                                                                   //
// this module is distributed in the hope that it will be useful,    //
// but WITHOUT ANY WARRANTY; without even the implied warranty of    //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.              //
// See the GNU General Public License for more details.              //
//                                                                   //
// You should have received a copy of the GNU General Public License //
// along with this module.  If not, write to:                        //
// 	The Free Software Foundation, Inc.,                              //
// 	51 Franklin Street, Fifth Floor                                  //
// 	Boston, MA  02110-1301, USA.                                     //
///////////////////////////////////////////////////////////////////////
unit ENGINE_CALLBACK;

{$I DEFINES.pas}

interface
uses
  Windows,
  ENGINE_VAR;

procedure OE_RegProcedure( PType : Byte; PAddress : Pointer ); stdcall;
procedure OE_UnRegProcedure( PType : Byte );                   stdcall;

const
  SYS_DRAW            = 0;
  SYS_INIT            = 1;
  SYS_QUIT            = 2;
  SYS_LOAD            = 3;
  SYS_WNDPROC_BEFORE  = 4;
  SYS_WNDPROC_AFTER   = 5;
  SYS_CONSOLE_MESSAGE = 6;

//----------------------------------------------------------------------------//
                                 IMPLEMENTATION
//----------------------------------------------------------------------------//

procedure OE_RegProcedure;
Begin

case PType of
SYS_DRAW            : app_PDraw          := PAddress;
SYS_INIT            : app_PInit          := PAddress;
SYS_QUIT            : app_PQuit          := PAddress;
SYS_LOAD            : app_PFinit         := PAddress;
SYS_WNDPROC_BEFORE  : app_PWndProcBefor  := PAddress;
SYS_WNDPROC_AFTER   : app_PWndProcAfter  := PAddress;
SYS_CONSOLE_MESSAGE : app_ConsoleMessage := PAddress;
end;

End;

procedure OE_UnRegProcedure;
Begin
case PType of
  SYS_DRAW            : app_PDraw := @ZeroProc;
  SYS_INIT            : app_PInit := @ZeroProc;
  SYS_QUIT            : app_PQuit := @ZeroProc;
  SYS_LOAD            : app_PFInit := @ZeroProc;
  SYS_WNDPROC_BEFORE  : app_PWndProcBefor := nil;
  SYS_WNDPROC_AFTER   : app_PWndProcAfter := nil;
  SYS_CONSOLE_MESSAGE : app_ConsoleMessage := nil;
end;
End;

end.
