00001 //////////////////////////////////////////////////////////////////////////////// 00002 // Scorched3D (c) 2000-2009 00003 // 00004 // This file is part of Scorched3D. 00005 // 00006 // Scorched3D is free software; you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 2 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // Scorched3D is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with Scorched3D; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 //////////////////////////////////////////////////////////////////////////////// 00020 00021 #include <client/ClientDialog.h> 00022 #include <graph/GLSetup.h> 00023 #include <graph/MainCamera.h> 00024 #include <graph/Main2DCamera.h> 00025 #include <graph/OptionsDisplay.h> 00026 #include <graph/Display.h> 00027 #include <graph/Gamma.h> 00028 #include <client/ClientParams.h> 00029 #include <common/OptionsTransient.h> 00030 #include <common/OptionsScorched.h> 00031 #include <common/Defines.h> 00032 #include <stdio.h> 00033 #include <time.h> 00034 00035 extern char scorched3dAppName[128]; 00036 00037 bool createScorchedWindow() 00038 { 00039 int width = OptionsDisplay::instance()->getScreenWidth(); 00040 int height = OptionsDisplay::instance()->getScreenHeight(); 00041 bool fullscreen = OptionsDisplay::instance()->getFullScreen(); 00042 00043 SDL_WM_SetCaption(scorched3dAppName, "tank2"); 00044 std::string iconFile = S3D::getDataFile("data/windows/tank2.bmp"); 00045 SDL_WM_SetIcon(SDL_LoadBMP(iconFile.c_str()), NULL); 00046 00047 if (!Display::instance()->changeSettings(width,height,fullscreen)) 00048 { 00049 S3D::dialogMessage("Scorched 3D Display", 00050 "ERROR: Failed to set the display mode.\n" 00051 "Ensure that no other application is exclusively using the graphics hardware.\n" 00052 "Ensure that the current desktop mode has at least 24 bits colour depth.\n"); 00053 return false; 00054 } 00055 00056 int windowWidth = 1024; 00057 int windowHeight = 768; 00058 switch (OptionsDisplay::instance()->getDialogSize()) 00059 { 00060 case 0: 00061 windowWidth = 1600; 00062 break; 00063 case 1: 00064 windowWidth = 1152; 00065 break; 00066 case 3: 00067 windowWidth = 800; 00068 break; 00069 } 00070 windowHeight = (height * windowWidth) / width; 00071 00072 MainCamera::instance()->getCamera().setWindowSize(width, height); 00073 Main2DCamera::instance()->getViewPort().setWindowSize(windowWidth, windowHeight, 00074 width, height); 00075 00076 Gamma::instance()->save(); 00077 Gamma::instance()->set(); 00078 00079 GLSetup::setup(); 00080 00081 return true; 00082 }
1.5.3