#include "tString.h"
#include "tCallback.h"
#include "tCallbackString.h"
#include "tRuby.h"
Go to the source code of this file.
#define rFEAT_DEFAULT 0 |
Definition at line 138 of file rScreen.h.
Referenced by ArmageTron_feature_menuitem::ArmageTron_feature_menuitem().
#define rFEAT_OFF -1 |
Definition at line 137 of file rScreen.h.
Referenced by ArmageTron_feature_menuitem::ArmageTron_feature_menuitem().
#define rFEAT_ON 1 |
Definition at line 139 of file rScreen.h.
Referenced by ArmageTron_feature_menuitem::ArmageTron_feature_menuitem().
#define rFLOOR_GRID 1 |
Definition at line 131 of file rScreen.h.
Referenced by eGrid::display_simple(), gCycle::Render(), and sr_LoadDefaultConfig().
#define rFLOOR_OFF 0 |
#define rFLOOR_TEXTURE 2 |
Definition at line 132 of file rScreen.h.
Referenced by eGrid::display_simple(), and sr_LoadDefaultConfig().
#define rFLOOR_TWOTEXTURE 3 |
Definition at line 133 of file rScreen.h.
Referenced by eGrid::display_simple(), and sr_LoadDefaultConfig().
#define rMIRROR_ALL 10 |
#define rMIRROR_OBJECTS 1 |
#define rMIRROR_OFF 0 |
#define rMIRROR_WALLS 2 |
enum rColorDepth |
Definition at line 44 of file rScreen.h.
00044 { 00045 ArmageTron_ColorDepth_16, ArmageTron_ColorDepth_Desktop, 00046 ArmageTron_ColorDepth_32 00047 }
enum rDisplayListUsage |
how should caching display lists be used?
Definition at line 110 of file rScreen.h.
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 };
enum rResolution |
Definition at line 36 of file rScreen.h.
00036 { 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 }
enum rVSync |
ArmageTron_VSync_On | |
ArmageTron_VSync_Default | |
ArmageTron_VSync_Off | |
ArmageTron_VSync_MotionBlur |
Definition at line 50 of file rScreen.h.
00050 { 00051 ArmageTron_VSync_On, ArmageTron_VSync_Default, ArmageTron_VSync_Off, 00052 ArmageTron_VSync_MotionBlur 00053 }
void sr_Activate | ( | bool | active | ) |
Definition at line 1100 of file rScreen.cpp.
References currentScreensetting, rCallbackBeforeScreenModeChange::Exec(), and rScreenSettings::fullscreen.
Referenced by Activate().
01102 { 01103 #ifndef DEDICATED 01104 if ( !currentScreensetting.fullscreen && !active && sr_keepWindowActive ) 01105 { 01106 sr_glOut=!active; 01107 } 01108 else 01109 { 01110 sr_glOut=active; 01111 } 01112 01113 // unload textures and stuff if rendering gets disabled 01114 if (!sr_glOut) 01115 rCallbackBeforeScreenModeChange::Exec(); 01116 01117 // Jonathans fullscreen bugfix. 01118 // z-man's ammendmend: apparently, doing this in Linux is painful as well. 01119 // Only on Windows, you get a deactivation event when you ALT-TAB away 01120 // from th application, then iconification is the right thing to do. 01121 // On Linux at least, there is no standard alt-tab for fullscreen applications. 01122 #ifdef WIN32 01123 if ( currentScreensetting.fullscreen && !active ) 01124 { 01125 SDL_WM_IconifyWindow(); 01126 } 01127 #endif 01128 #endif
void sr_DepthOffset | ( | bool | offset | ) |
Definition at line 1074 of file rScreen.cpp.
Referenced by eGrid::display_simple(), gCycle::Render(), gCycleWallsDisplayListManager::RenderAll(), gNetPlayerWall::RenderBegin(), and gNetPlayerWall::RenderNormal().
01075 { 01076 // return; 01077 // if(offset!=offs){ 01078 //offs=offset; 01079 #ifndef DEDICATED 01080 if (offset){ 01081 //glMatrixMode(GL_PROJECTION); 01082 //glScalef(.9,.9,.9); 01083 glPolygonOffset(-2,-5); 01084 glEnable(GL_POLYGON_OFFSET_LINE); 01085 glEnable(GL_POLYGON_OFFSET_POINT); 01086 glEnable(GL_POLYGON_OFFSET_FILL); 01087 } 01088 else{ 01089 glPolygonOffset(0,0); 01090 glDisable(GL_POLYGON_OFFSET_POINT); 01091 glDisable(GL_POLYGON_OFFSET_LINE); 01092 glDisable(GL_POLYGON_OFFSET_FILL); 01093 //glMatrixMode(GL_PROJECTION); 01094 //glScalef(1/.9,1/.9,1/.9); 01095 } 01096 // } 01097 #endif
bool sr_DesktopScreensizeSupported | ( | ) |
Definition at line 119 of file rScreen.cpp.
Referenced by gResMenEntry::gResMenEntry(), and lowlevel_sr_InitDisplay().
00120 { 00121 #ifndef DEDICATED 00122 SDL_version const & sdlVersion = *SDL_Linked_Version(); 00123 00124 return 00125 sdlVersion.major > 1 || sdlVersion.major == 1 && 00126 ( sdlVersion.minor > 2 || sdlVersion.minor == 2 && 00127 ( sdlVersion.patch >= 10 ) ); 00128 #else 00129 return false; 00130 #endif
void sr_ExitDisplay | ( | ) |
Definition at line 889 of file rScreen.cpp.
References rCallbackBeforeScreenModeChange::Exec(), rSysDep::ExitGL(), NULL, sr_LockSDL(), sr_screen, sr_UnlockSDL(), and st_SaveConfig().
Referenced by cleanup(), main(), sr_InitDisplay(), and sr_ReinitDisplay().
00890 { 00891 #ifndef DEDICATED 00892 rCallbackBeforeScreenModeChange::Exec(); 00893 00894 #ifdef DIRTY 00895 rSysDep::ExitGL(); 00896 #endif 00897 00898 if (sr_screen){ 00899 failed_attempts = 0; 00900 st_SaveConfig(); 00901 00902 sr_LockSDL(); 00903 // z-man: according to man SDL_SetVideoSurface, screen should not bee freed. 00904 // SDL_FreeSurface(sr_screen); 00905 sr_screen=NULL; 00906 sr_UnlockSDL(); 00907 //SDL_Quit(); 00908 } 00909 #endif
bool sr_InitDisplay | ( | ) |
Definition at line 819 of file rScreen.cpp.
References currentScreensetting, rScreenSettings::fullscreen, lastError, lastSuccess, lowlevel_sr_InitDisplay(), MAXEMERGENCY, sr_ExitDisplay(), sr_LockSDL(), sr_UnlockSDL(), st_SaveConfig(), and tERR_ERROR.
Referenced by main(), and sr_ReinitDisplay().
00820 { 00821 cycleprograminited = false; 00822 while (failed_attempts <= MAXEMERGENCY+1) 00823 { 00824 #ifndef DEBUG 00825 if (failed_attempts) 00826 currentScreensetting = *emergency[failed_attempts]; 00827 00828 failed_attempts++; 00829 st_SaveConfig(); 00830 00831 // std::cout << failed_attempts << "\n"; 00832 // std::cout.flush(); 00833 #endif 00834 00835 #ifdef MACOSX 00836 // init the screen once in windowed mode 00837 static bool first = true; 00838 if ( first && currentScreensetting.fullscreen ) 00839 { 00840 first = false; 00841 currentScreensetting.fullscreen = false; 00842 00843 sr_LockSDL(); 00844 if (lowlevel_sr_InitDisplay()) 00845 { 00846 sr_ExitDisplay(); 00847 } 00848 sr_UnlockSDL(); 00849 00850 currentScreensetting.fullscreen = true; 00851 } 00852 #endif 00853 00854 sr_LockSDL(); 00855 if (lowlevel_sr_InitDisplay()) 00856 { 00857 lastSuccess=currentScreensetting; 00858 sr_UnlockSDL(); 00859 return true; 00860 } 00861 00862 st_SaveConfig(); 00863 00864 if (lowlevel_sr_InitDisplay()) 00865 { 00866 lastSuccess=currentScreensetting; 00867 sr_UnlockSDL(); 00868 return true; 00869 } 00870 sr_UnlockSDL(); 00871 00872 00873 } 00874 00875 failed_attempts = 1; 00876 st_SaveConfig(); 00877 00878 tERR_ERROR("\nSorry, played all my cards trying to " 00879 "initialize your video system.\n" 00880 << tOutput("$program_name") << " won't run on your computer. Reason:\n\n" 00881 << lastError 00882 << "\n\nI'll try again from the beginning, but the " 00883 << "chances of success are minimal.\n" 00884 ); 00885 00886 return false;
void sr_LoadDefaultConfig | ( | ) |
Definition at line 935 of file rScreen.cpp.
References default_texturemode, rDisplayList_CAC, rDisplayList_Off, rFLOOR_GRID, rFLOOR_TEXTURE, rFLOOR_TWOTEXTURE, rMIRROR_OFF, rSysDep::rSwap_glFinish, rSysDep::rSwap_glFlush, sr_useDisplayLists, rSysDep::swapMode_, rTextureGroups::TEX_FONT, rTextureGroups::TEX_GROUPS, rTextureGroups::TEX_OBJ, and rTextureGroups::TextureMode.
Referenced by lowlevel_sr_InitDisplay(), and welcome().
00936 { 00937 00938 // High detail defaults; no problem for your ordinary 3d-card. 00939 sr_alphaBlend=true; 00940 sr_useDisplayLists=rDisplayList_Off; 00941 sr_textOut=true; 00942 sr_dither=true; 00943 sr_smoothShading=true; 00944 int i; 00945 #ifndef DEDICATED 00946 for (i=rTextureGroups::TEX_GROUPS-1;i>=0;i--) 00947 rTextureGroups::TextureMode[i]=default_texturemode; 00948 00949 // fonts look best in bilinear filtering, no mipmaps 00950 rTextureGroups::TextureMode[rTextureGroups::TEX_FONT]=GL_LINEAR; 00951 #endif 00952 sr_floorDetail=rFLOOR_TWOTEXTURE; 00953 sr_floorMirror=rMIRROR_OFF; 00954 sr_infinityPlane=false; 00955 sr_lowerSky=false; 00956 sr_upperSky=false; 00957 sr_keepWindowActive=false; 00958 rSysDep::swapMode_=rSysDep::rSwap_glFinish; 00959 00960 if (software_renderer){ 00961 // A software renderer! Poor soul. Set low details: 00962 for (i=rTextureGroups::TEX_GROUPS-1;i>=0;i--) 00963 rTextureGroups::TextureMode[i]=-1; 00964 00965 #ifndef DEDICATED 00966 rTextureGroups::TextureMode[rTextureGroups::TEX_OBJ]=GL_NEAREST_MIPMAP_NEAREST; 00967 rTextureGroups::TextureMode[rTextureGroups::TEX_FONT]=GL_NEAREST_MIPMAP_NEAREST; 00968 #endif 00969 00970 sr_highRim=false; 00971 sr_dither=false; 00972 sr_alphaBlend=false; 00973 sr_smoothShading=true; // smooth shading does not slow down the 00974 // two tested renderers; leave it it. 00975 sr_floorDetail=rFLOOR_GRID; 00976 sr_floorMirror=rMIRROR_OFF; 00977 } 00978 else if(strstr(gl_vendor,"3Dfx")){ 00979 //workaround for 3dfx renderer: aliasing must be turned on 00980 //sr_lineAntialias=rFEAT_OFF; 00981 } 00982 else if(strstr(gl_vendor,"NVIDIA")){ 00983 // infinity , display lists and glFlush swapping work for NVIDIA 00984 sr_infinityPlane=true; 00985 sr_useDisplayLists=rDisplayList_CAC; 00986 rSysDep::swapMode_=rSysDep::rSwap_glFlush; 00987 } 00988 #ifdef MACOSX 00989 else if(strstr(gl_vendor,"ATI")){ 00990 // glFlush swapping work for ATI on the mac 00991 rSysDep::swapMode_=rSysDep::rSwap_glFlush; 00992 } 00993 #endif 00994 else if(strstr(gl_vendor,"Matrox")){ 00995 sr_floorDetail = rFLOOR_TEXTURE; // double textured floor does not work 00996 }
void sr_LockSDL | ( | ) |
Definition at line 1002 of file rSysdep.cpp.
Referenced by rSurface::Create(), sr_ExitDisplay(), sr_InitDisplay(), su_GetSDLInput(), rSysDep::SwapGL(), rISurfaceTexture::Upload(), and welcome().
01003 { 01004 //std::cerr << "locking..."; 01005 #ifndef DEDICATED 01006 #ifndef WIN32 01007 //SDL_mutexP(mut); 01008 #endif 01009 #endif 01010 //std::cerr << " locked!\n";
void sr_ReinitDisplay | ( | ) |
Definition at line 365 of file rScreen.cpp.
References sr_ExitDisplay(), sr_InitDisplay(), and tERR_ERROR.
Referenced by sg_ScreenModeMenu(), and toggle_fullscreen_func().
00366 { 00367 sr_ExitDisplay(); 00368 if (!sr_InitDisplay()){ 00369 tERR_ERROR("Oops. Failed to reinit video hardware. " 00370 "Resetting to defaults..\n"); 00371 exit(-1); 00372 } 00373
void sr_ResetRenderState | ( | bool | menu = 0 |
) |
Definition at line 998 of file rScreen.cpp.
References glMatrixMode, sr_screenHeight, and sr_screenWidth.
Referenced by display_cockpit_lucifer(), uMenu::GenericBackground(), init_game_grid(), lowlevel_sr_InitDisplay(), uMenu::Message(), uMenu::OnEnter(), Render(), cCockpit::Render(), rConsole::Render(), RenderAllViewports(), and welcome().
00999 { 01000 if(!sr_glOut) 01001 return; 01002 #ifndef DEDICATED 01003 01004 // Z-Buffering and perspective correction 01005 01006 if (menu){ 01007 glDisable(GL_DEPTH_TEST); 01008 glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); 01009 glViewport (0, 0, GLsizei(sr_screenWidth), GLsizei(sr_screenHeight)); 01010 } 01011 else{ 01012 glEnable(GL_DEPTH_TEST); 01013 glDepthFunc(GL_LEQUAL); 01014 } 01015 01016 if (sr_dither) 01017 glEnable(GL_DITHER); 01018 else 01019 glDisable(GL_DITHER); 01020 01021 glDisable(GL_LIGHTING); 01022 01023 // disable texture mapping (selecting textures will reactivate it) 01024 01025 // glDisable(GL_TEXTURE); 01026 glDisable(GL_TEXTURE_2D); 01027 01028 01029 // flat or smooth shading 01030 if (sr_smoothShading) 01031 glShadeModel(GL_SMOOTH); 01032 else 01033 glShadeModel(GL_FLAT); 01034 01035 // alpha blending 01036 if (sr_alphaBlend){ 01037 glEnable(GL_ALPHA_TEST); 01038 glAlphaFunc(GL_GREATER,0); 01039 glEnable(GL_BLEND); 01040 glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); 01041 } 01042 else{ 01043 glDisable(GL_ALPHA_TEST); 01044 glDisable(GL_BLEND); 01045 } 01046 01047 // reset matrices 01048 glMatrixMode(GL_TEXTURE); 01049 glLoadIdentity(); 01050 01051 glMatrixMode(GL_PROJECTION); 01052 glLoadIdentity(); 01053 01054 glMatrixMode(GL_MODELVIEW); 01055 glLoadIdentity(); 01056 #endif
void sr_UnlockSDL | ( | ) |
Definition at line 1012 of file rSysdep.cpp.
Referenced by rSurface::Create(), sr_ExitDisplay(), sr_InitDisplay(), su_GetSDLInput(), rSysDep::SwapGL(), rISurfaceTexture::Upload(), and welcome().
01013 { 01014 //std::cerr << "unlocking..."; 01015 #ifndef DEDICATED 01016 #ifndef WIN32 01017 //SDL_mutexV(mut); 01018 #endif 01019 #endif 01020 //std::cerr << " unlocked!\n";
Definition at line 385 of file rScreen.cpp.
Referenced by filter(), sr_InitDisplay(), and rSysDep::SwapGL().
Definition at line 933 of file rScreen.cpp.
Referenced by ConnectToServerCore(), lowlevel_sr_InitDisplay(), and main().
bool sr_alphaBlend |
Definition at line 911 of file rScreen.cpp.
Referenced by eGrid::display_simple(), cWidget::Map::DrawRimWalls(), rTextField::FlushLine(), rDisplayListAlphaSensitive::OnCall(), uMenu::OnEnter(), paint_sr_lowerSky(), rFont::ProcessImage(), zShapePolygon::render(), zShapeCircle::render(), gZone::Render(), gCycle::Render(), and gZone::RendersAlpha().
bool sr_dither |
Definition at line 922 of file rScreen.cpp.
int sr_floorDetail |
Definition at line 917 of file rScreen.cpp.
Referenced by eGrid::display_simple(), gCycle::Render(), and se_FloorColor().
int sr_floorMirror |
bool sr_FPSOut |
Definition at line 929 of file rScreen.cpp.
bool sr_glOut |
Definition at line 912 of file rScreen.cpp.
bool sr_highRim |
Definition at line 918 of file rScreen.cpp.
Referenced by eGrid::display_simple(), eWallRim::eWallRim(), and infinity_xy_plane().
bool sr_infinityPlane |
Definition at line 923 of file rScreen.cpp.
Referenced by gWallRim_helper(), and infinity_xy_plane().
bool sr_keepWindowActive |
bool sr_laggometer |
bool sr_lowerSky |
bool sr_predictObjects |
Definition at line 925 of file rScreen.cpp.
Referenced by net_options(), gNetPlayerWall::RealWallReceived(), gCycle::Render(), gAIPlayer::ThinkCloseCombat(), and eGameObject::TimestepThisWrapper().
SDL_Surface* sr_screen |
Definition at line 68 of file rScreen.cpp.
Referenced by rConsole::DoPrint(), lowlevel_sr_InitDisplay(), rConsole::Render(), and sr_ExitDisplay().
int sr_screenHeight |
Definition at line 80 of file rScreen.cpp.
Referenced by rFontContainer::BBox(), display_cockpit_lucifer(), rViewport::EqualAspectBottom(), filter(), rFontContainer::GetFont(), rFontContainer::GetWidth(), lowlevel_sr_InitDisplay(), make_screenshot(), MenuBackground(), rViewport::Perspective(), cCockpit::Readjust(), rFontContainer::Render(), rConsole::Render(), rTextField::rTextField(), SDL_SavePNG(), rViewport::Select(), sr_MotionBlur(), sr_MotionBlurCore(), sr_ResetRenderState(), su_TransformEvent(), and rViewport::UpDownFOV().
Definition at line 256 of file rSysdep.cpp.
Referenced by make_screenshot(), screenshot_func(), and rSysDep::SwapGL().
int sr_screenWidth |
Definition at line 80 of file rScreen.cpp.
Referenced by rFontContainer::BBox(), display_cockpit_lucifer(), rViewport::EqualAspectBottom(), filter(), rFontContainer::GetWidth(), lowlevel_sr_InitDisplay(), make_screenshot(), MenuBackground(), rViewport::Perspective(), cCockpit::ProcessCockpit(), cCockpit::Readjust(), cWidget::Map::Render(), cCockpit::Render(), rFontContainer::Render(), rConsole::Render(), SDL_SavePNG(), rViewport::Select(), sr_MotionBlur(), sr_MotionBlurCore(), sr_ResetRenderState(), su_TransformEvent(), and rViewport::UpDownFOV().
bool sr_skyWobble |
bool sr_smoothShading |
Definition at line 913 of file rScreen.cpp.
bool sr_textOut |
Definition at line 928 of file rScreen.cpp.
Referenced by gServerBrowser::BrowseLAN(), gServerBrowser::BrowseSpecialMaster(), ConnectToServerCore(), rConsole::DoPrint(), MainMenu(), uMenu::Message(), rConsole::Render(), and welcome().
bool sr_texturesTruecolor |
bool sr_upperSky |
Definition at line 74 of file rScreen.cpp.
Referenced by sr_LoadDefaultConfig(), rDisplayListFiller::Start(), and rDisplayListFiller::Stop().