src/render/rScreen.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_SCREEN_H
00029 #define ArmageTron_SCREEN_H
00030 
00031 #include "tString.h"
00032 #include "tCallback.h"
00033 #include "tCallbackString.h"
00034 #include "tRuby.h"
00035 
00036 typedef enum {
00037     ArmageTron_Desktop=0,ArmageTron_320_200,ArmageTron_Min=ArmageTron_320_200, ArmageTron_320_240,ArmageTron_400_300,
00038     ArmageTron_512_384,ArmageTron_640_480,ArmageTron_800_600,
00039     ArmageTron_1024_768,ArmageTron_1280_800,ArmageTron_1280_854,ArmageTron_1280_1024,
00040     ArmageTron_1600_1200,ArmageTron_1680_1050,ArmageTron_2048_1572,ArmageTron_Custom, ArmageTron_Invalid=-1
00041 }
00042 rResolution;
00043 
00044 typedef enum {
00045     ArmageTron_ColorDepth_16, ArmageTron_ColorDepth_Desktop,
00046     ArmageTron_ColorDepth_32
00047 }
00048 rColorDepth;
00049 
00050 typedef enum {
00051     ArmageTron_VSync_On, ArmageTron_VSync_Default, ArmageTron_VSync_Off,
00052     ArmageTron_VSync_MotionBlur
00053 }
00054 rVSync;
00055 
00056 struct rScreenSize
00057 {
00058     rResolution         res;
00059     int                 width, height;
00060 
00061     rScreenSize( int width, int height ); 
00062     explicit rScreenSize( rResolution r = ArmageTron_Invalid ); 
00063     void UpdateSize();                                          
00064 
00065     bool operator ==( rScreenSize const & other ) const; 
00066     bool operator !=( rScreenSize const & other ) const; 
00067 
00068     int Compare( rScreenSize const & other ) const; 
00069 };
00070 
00071 class rScreenSettings
00072 {
00073 public:
00074     rScreenSize                 res;
00075     rScreenSize                 windowSize;
00076     bool                                fullscreen;
00077     rColorDepth                 colorDepth;
00078     rColorDepth                 zDepth;
00079     bool                                useSDL;
00080     bool                                checkErrors;
00081     rVSync              vSync;          // whether to wait for vsync
00082     REAL                                aspect;                 // aspect ratio of pixels ( width/height )
00083 
00084     rScreenSettings(rResolution r,
00085                     bool fs=true,
00086                     rColorDepth cd=ArmageTron_ColorDepth_Desktop,
00087                     bool sdl=true,
00088                     bool ce =true);
00089 };
00090 
00091 bool sr_DesktopScreensizeSupported();
00092 
00093 extern rScreenSettings currentScreensetting;
00094 extern rScreenSettings lastSuccess;
00095 
00096 struct SDL_Surface;
00097 extern SDL_Surface *sr_screen;
00098 
00099 extern int sr_screenWidth,sr_screenHeight;
00100 
00101 extern bool sr_alphaBlend;
00102 extern bool sr_screenshotIsPlanned;
00103 extern bool sr_smoothShading;
00104 
00105 extern bool sr_glOut;           // do we have gl-output at all?
00106 extern bool sr_textOut;          // display game text graphically?
00107 extern bool sr_FPSOut;           // display frame counter?
00108 
00110 enum rDisplayListUsage
00111 {
00112     rDisplayList_Off=0, // not at all
00113     rDisplayList_CAC,   // yes, with GL_COMPILE, then glCallList.
00114     rDisplayList_CAE,   // yes, with GL_COMPILE_AND_EXECUTE
00115     rDisplayList_Count
00116 };
00117 
00118 extern rDisplayListUsage sr_useDisplayLists;   // use GL display lists
00119 // not delete the screen, just pait the background with depth test
00120 // disabled. Gives 20% speedup.
00121 
00122 
00123 #define rMIRROR_OFF     0
00124 #define rMIRROR_OBJECTS 1
00125 #define rMIRROR_WALLS   2
00126 #define rMIRROR_ALL     10
00127 
00128 extern int sr_floorMirror;
00129 
00130 #define rFLOOR_OFF        0
00131 #define rFLOOR_GRID       1
00132 #define rFLOOR_TEXTURE    2
00133 #define rFLOOR_TWOTEXTURE 3
00134 
00135 extern int sr_floorDetail;
00136 
00137 #define rFEAT_OFF    -1
00138 #define rFEAT_DEFAULT 0
00139 #define rFEAT_ON      1
00140 
00141 extern bool sr_highRim;
00142 extern bool sr_upperSky,sr_lowerSky;
00143 extern bool sr_skyWobble;
00144 extern bool sr_dither;
00145 extern bool sr_infinityPlane;
00146 extern bool sr_laggometer;
00147 extern bool sr_predictObjects;
00148 extern bool sr_texturesTruecolor;
00149 extern bool sr_keepWindowActive;
00150 
00151 extern tString renderer_identification;  // type of renderer used
00152 
00153 extern tString gl_vendor;
00154 extern tString gl_renderer;
00155 extern tString gl_version;
00156 extern tString gl_extensions;
00157 
00158 class rPerFrameTask:public tCallback{
00159 public:
00160     rPerFrameTask(AA_VOIDFUNC *f);
00161     static void DoPerFrameTasks();
00162 };
00163 
00164 #ifdef HAVE_LIBRUBY
00165 class rPerFrameTaskRuby : public tCallbackRuby {
00166 public:
00167     rPerFrameTaskRuby();
00168     static void DoPerFrameTasks();
00169 };
00170 #endif
00171 
00172 class rRenderIdCallback:public tCallbackString{
00173 public:
00174     rRenderIdCallback(STRINGRETFUNC *f);
00175     static tString RenderId();
00176 };
00177 
00178 class rCallbackBeforeScreenModeChange:public tCallback{
00179 public:
00180     rCallbackBeforeScreenModeChange(AA_VOIDFUNC *f);
00181     static void Exec();
00182 };
00183 
00184 class rCallbackAfterScreenModeChange:public tCallback{
00185 public:
00186     rCallbackAfterScreenModeChange(AA_VOIDFUNC *f);
00187     static void Exec();
00188 };
00189 
00190 bool sr_InitDisplay();
00191 void sr_ExitDisplay();
00192 void sr_ReinitDisplay();
00193 
00194 void sr_LoadDefaultConfig();
00195 
00196 void sr_ResetRenderState(bool menu=0);
00197 void sr_DepthOffset(bool offset);
00198 void sr_Activate(bool active); // set activation staus
00199 
00200 void sr_LockSDL();
00201 void sr_UnlockSDL();
00202 #endif

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