///////////////////////////////////////////////////////////////////////
// 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_FLAGS;

{$I DEFINES.pas}

interface
uses
  OpenGL,
  ENGINE_VAR;


procedure OE_Enable( What : Integer ); stdcall;
procedure OE_Disable( What : Integer ); stdcall;

const
  FLAG_CLEAR_COLOR_BUFFER = $000001;
  FLAG_CROP_UNVISIBLE_OBJ = $000002;
  FLAG_RESOLUTION_CORRECT = $000004;
  FLAG_SHOW_WARNINGS      = $000008;
  FLAG_SHOW_ERRORS        = $000010;
  FLAG_PAUSE              = $000020;
  FLAG_AUTO_PAUSE         = $000040;

var
  F_ColorBufferClear  : Byte = 1;
  F_CropUnvisibleObj  : Byte = 1;
  F_ResolutionCorrect : Byte = 0;
  F_Flags             : Integer = FLAG_CLEAR_COLOR_BUFFER or FLAG_CROP_UNVISIBLE_OBJ;
//----------------------------------------------------------------------------//
                                 IMPLEMENTATION
//----------------------------------------------------------------------------//

procedure OE_Enable;
Begin
if What and FLAG_CLEAR_COLOR_BUFFER > 0 Then F_ColorBufferClear  := 1;
if What and FLAG_CROP_UNVISIBLE_OBJ > 0 Then F_CropUnvisibleObj  := 1;
if What and FLAG_RESOLUTION_CORRECT > 0 Then F_ResolutionCorrect := 1;
if What and FLAG_SHOW_WARNINGS > 0 Then app_ShowWarnings := TRUE;
if What and FLAG_SHOW_ERRORS > 0 Then app_ShowErrors := TRUE;
if What and FLAG_PAUSE > 0 Then app_Pause := TRUE;
if What and FLAG_AUTO_PAUSE > 0 Then app_AutoPause := TRUE;
F_Flags := F_Flags or What;
End;

procedure OE_Disable;
Begin
if What and FLAG_CLEAR_COLOR_BUFFER > 0 Then F_ColorBufferClear  := 0;
if What and FLAG_CROP_UNVISIBLE_OBJ > 0 Then F_CropUnvisibleObj  := 0;
if What and FLAG_RESOLUTION_CORRECT > 0 Then F_ResolutionCorrect := 0;
if What and FLAG_SHOW_WARNINGS > 0 Then app_ShowWarnings := FALSE;
if What and FLAG_SHOW_ERRORS > 0 Then app_ShowErrors := FALSE;
if What and FLAG_PAUSE > 0 Then app_Pause := FALSE;
if What and FLAG_AUTO_PAUSE > 0 Then app_AutoPause := FALSE;

if F_Flags and What > 0 Then F_Flags := F_Flags xor What;
End;

end.
