src/defs.h

Go to the documentation of this file.
00001 /*
00002 
00003 *************************************************************************
00004 
00005 ArmageTron -- Just another Tron Lightcycle Game in 3D.
00006 Copyright (C) 2000  Manuel Moos (manuel@moosnet.de)
00007 
00008 **************************************************************************
00009 
00010 This program is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 This program is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00023   
00024 ***************************************************************************
00025 
00026 */
00027 
00028 #ifndef ARMAGETRON_DEFS_H
00029 #define ARMAGETRON_DEFS_H
00030 
00031 #ifdef _MSC_VER
00032 // disable nasty conversion complains of MSVC++
00033 #pragma warning ( disable : 4244 4305 4800 4250)
00034 //#pragma warning ( disable : 4800 4081 4244 4305 4244 4250 4541)
00035 #endif
00036 
00037 #include "aa_config.h"
00038 
00039 #ifdef WIN32
00040 #include <windows.h>
00041 #endif
00042 
00043 #include <math.h>
00044 #include <iosfwd>
00045 
00046 // Includes required for GCC 4.3 only. Remove them as soon as some of 
00047 // us developers have GCC 4.3, then it is of course better to only put them
00048 // where they are needed.
00049 #include <string.h>
00050 #include <memory>
00051 #include <typeinfo>
00052 #include <cstdlib>
00053 // end of GCC 4.3 includes
00054 
00055 // maximum number of supported viewports
00056 #ifndef MAX_VIEWERS
00057 #define MAX_VIEWERS 4
00058 #endif
00059 
00060 #ifndef M_PI
00061 #define M_PI 3.14159f
00062 #endif
00063 
00064 typedef float REAL;
00065 const REAL EPS=REAL(1E-7);
00066 
00067 template<class T> void Swap(T &a,T &b){
00068     T c=a;
00069     a=b;
00070     b=c;
00071 }
00072 typedef void AA_VOIDFUNC();
00073 typedef void INTFUNC(int);
00074 typedef bool BOOLRETFUNC();
00075 
00076 typedef AA_VOIDFUNC *FUNCPTR;
00077 typedef INTFUNC *INTFUNCPTR;
00078 
00079 // replacements for float math functions
00080 #ifndef HAVE_SINF
00081 inline REAL sinf( REAL angle ) throw() { return REAL(sin( angle )); }
00082 #endif
00083 
00084 #ifndef HAVE_COSF
00085 inline REAL cosf( REAL angle ) throw() { return REAL(cos( angle )); }
00086 #endif
00087 
00088 #ifndef HAVE_TANF
00089 inline REAL tanf( REAL angle ) throw() { return REAL(tan( angle )); }
00090 #endif
00091 
00092 #ifndef HAVE_ATAN2F
00093 inline REAL atan2f( REAL y, REAL x ) throw() { return REAL(atan2( y, x )); }
00094 #endif
00095 
00096 #ifndef HAVE_SQRTF
00097 inline REAL sqrtf( REAL x ) throw() { return REAL(sqrt( x )); }
00098 #endif
00099 
00100 #ifndef HAVE_LOGF
00101 inline REAL logf( REAL x ) throw() { return REAL(log( x )); }
00102 #endif
00103 
00104 #ifndef HAVE_EXPF
00105 inline REAL expf( REAL x ) throw() { return REAL(exp( x )); }
00106 #endif
00107 
00108 #ifndef HAVE_FABSF
00109 inline REAL fabsf( REAL x ) throw() { return REAL(fabs( x )); }
00110 #endif
00111 
00112 #ifndef HAVE_FLOORF
00113 inline REAL floorf( REAL x ) throw() { return REAL(floor( x )); }
00114 #endif
00115 
00116 #ifndef HAVE_ISBLANK
00117 // this function does not seem to exist in windows and solaris 2.8
00118 inline bool isblank(int x){ return ((x == ' ') || (x == '\t')); }
00119 #endif
00120 
00121 #ifdef _MSC_VER
00122 
00123 #include <iostream>
00124 //#include <iostream>
00125 //#include <strstrea>
00126 #else
00127 #include <iostream>
00128 //#include <>
00129 #endif
00130 
00131 #ifndef HAVE_POW10
00132 inline double pow10(double y) throw() { return pow(10.0, y); }
00133 #endif
00134 
00135 #ifndef HAVE_POW10F
00136 inline float pow10f(float y) throw() { return powf(10.0, y); }
00137 #endif
00138 
00139 #endif

Generated on Sat Mar 15 22:55:43 2008 for Armagetron Advanced by  doxygen 1.5.4