Display.cpp

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2003
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 "Display-def.cpp"
00022 
00023 static void createMainControls(wxWindow *parent, wxSizer *sizer)
00024 {
00025         {
00026         // Display settings
00027         wxStaticBox *displayBox = new wxStaticBox(parent, -1, wxT("&Display"));
00028         wxStaticBoxSizer *displaySizer = new wxStaticBoxSizer(displayBox, wxVERTICAL);
00029         wxFlexGridSizer *displaySizer2 = new wxFlexGridSizer(2, 3, 5, 5);
00030         wxStaticText *resText = new wxStaticText(parent, -1, wxT("&Resolution :"));
00031         IDC_DISPLAY_CTRL = 
00032                 new wxComboBox(parent, -1,
00033                 wxT(""),
00034                 wxDefaultPosition, wxSize(315, -1),
00035                 0, 0, wxCB_READONLY);
00036         IDC_FULLSCREEN_CTRL = 
00037                 new wxCheckBox(parent, -1, wxT("Full Screen"));
00038         IDC_MORERES_CTRL =
00039                 new wxCheckBox(parent, ID_MORERES, wxT("More Resolutions"));
00040         displaySizer2->Add(resText, 0, wxALIGN_CENTER_VERTICAL);
00041         displaySizer2->Add(IDC_DISPLAY_CTRL, 0);
00042         displaySizer2->Add(IDC_FULLSCREEN_CTRL, 0, wxALIGN_CENTRE_VERTICAL);
00043         wxStaticText *brightText = new wxStaticText(parent, -1, wxT("&Brightness :"));
00044         IDC_SLIDER1_CTRL = 
00045                 new wxSlider(parent, -1,
00046                 0,0,0,
00047                 wxDefaultPosition, wxSize(315, -1),
00048                 wxSL_HORIZONTAL | wxSL_AUTOTICKS);
00049         displaySizer2->Add(brightText, 0, wxALIGN_CENTER_VERTICAL);
00050         displaySizer2->Add(IDC_SLIDER1_CTRL, 0);
00051         displaySizer2->Add(IDC_MORERES_CTRL, 0, wxALIGN_CENTRE_VERTICAL);
00052         displaySizer->Add(displaySizer2, 0);
00053 
00054         wxFlexGridSizer *displaySizer3 = new wxFlexGridSizer(1, 7, 5, 5);
00055 
00056         displaySizer3->Add(new wxStaticText(parent, -1, wxT("&Dialog/Font Sizes :")));
00057         IDC_TINYDIALOGS_CTRL = new wxRadioButton(parent, -1, wxT("Tiny"), 
00058                 wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
00059         IDC_SMALLDIALOGS_CTRL = new wxRadioButton(parent, -1, wxT("Small"));
00060         IDC_MEDIUMDIALOGS_CTRL = new wxRadioButton(parent, -1, wxT("Medium"));
00061         IDC_LARGEDIALOGS_CTRL = new wxRadioButton(parent, -1, wxT("Large"));
00062         wxStaticText *frameLimitText = new wxStaticText(parent, -1, wxT("     Limit Framerate :"));
00063         IDC_FRAMELIMIT_CTRL = 
00064                 new wxTextCtrl(parent, -1, wxString(), wxDefaultPosition, wxSize(60, -1));
00065         displaySizer3->Add(IDC_TINYDIALOGS_CTRL);
00066         displaySizer3->Add(IDC_SMALLDIALOGS_CTRL);
00067         displaySizer3->Add(IDC_MEDIUMDIALOGS_CTRL);
00068         displaySizer3->Add(IDC_LARGEDIALOGS_CTRL);
00069         displaySizer3->Add(frameLimitText, -1, wxALIGN_CENTRE_VERTICAL);
00070         displaySizer3->Add(IDC_FRAMELIMIT_CTRL);
00071         displaySizer->Add(displaySizer3, 0, wxTOP | wxBOTTOM, 10);
00072         sizer->Add(displaySizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
00073 
00074         wxStaticText *aliasText = new wxStaticText(parent, -1, wxT("Anti Aliasing :"));
00075         displaySizer2->Add(aliasText, 0);
00076         IDC_ANTIALIAS_CTRL = new wxComboBox(parent, -1,
00077                 wxT(""),
00078                 wxDefaultPosition, wxSize(60, -1),
00079                 0, 0, wxCB_READONLY);
00080         displaySizer2->Add(IDC_ANTIALIAS_CTRL, 0);
00081         IDC_FOCUSPAUSE_CTRL =
00082                 new wxCheckBox(parent, -1, wxT("Pause graphics when not focused"));
00083         displaySizer2->Add(IDC_FOCUSPAUSE_CTRL, 0);
00084 
00085         }
00086 
00087         {
00088         // Sound settings
00089         wxStaticBox *soundBox = new wxStaticBox(parent, -1, wxT("&Sound"));
00090         wxStaticBoxSizer *soundSizerMain = new wxStaticBoxSizer(soundBox, wxVERTICAL);
00091         wxFlexGridSizer *soundSizer1 = new wxFlexGridSizer(4, 2);
00092         wxStaticText *volumeText = new wxStaticText(parent, -1, wxT("Sound Volume :"));
00093         wxStaticText *musicVolumeText = new wxStaticText(parent, -1, wxT("Music Volume :"));
00094         wxStaticText *ambientVolumeText = new wxStaticText(parent, -1, wxT("Ambient Volume :"));
00095         IDC_VOLUME_CTRL = 
00096                 new wxSlider(parent, -1,
00097                 0,0,0,
00098                 wxDefaultPosition, wxSize(315, -1),
00099                 wxSL_HORIZONTAL | wxSL_AUTOTICKS);
00100         IDC_SOUNDCHANNELS_CTRL = 
00101                 new wxComboBox(parent, -1,
00102                         wxT(""),
00103                         wxDefaultPosition, wxSize(55, -1),
00104                         0, 0, wxCB_READONLY);
00105         IDC_MUSICVOLUME_CTRL = 
00106                 new wxSlider(parent, -1,
00107                 0,0,0,
00108                 wxDefaultPosition, wxSize(315, -1),
00109                 wxSL_HORIZONTAL | wxSL_AUTOTICKS);
00110         IDC_AMBIENTVOLUME_CTRL = 
00111                 new wxSlider(parent, -1,
00112                 0,0,0,
00113                 wxDefaultPosition, wxSize(315, -1),
00114                 wxSL_HORIZONTAL | wxSL_AUTOTICKS);
00115         IDC_NOSOUND_CTRL = 
00116                 new wxCheckBox(parent, -1, wxT("No Sound"));
00117         IDC_NOMUSIC_CTRL = 
00118                 new wxCheckBox(parent, -1, wxT("No Music"));
00119         soundSizer1->Add(volumeText, 0, wxRIGHT, 10);
00120         soundSizer1->Add(IDC_VOLUME_CTRL, 0, wxRIGHT, 10);
00121         soundSizer1->Add(IDC_SOUNDCHANNELS_CTRL, 0, wxRIGHT, 5);
00122         soundSizer1->Add(new wxStaticText(parent, -1, wxT("Channels")), 0, wxALIGN_CENTRE_VERTICAL);
00123         soundSizer1->Add(ambientVolumeText, 0, wxRIGHT, 10);
00124         soundSizer1->Add(IDC_AMBIENTVOLUME_CTRL, 0, wxRIGHT, 10);
00125         soundSizer1->Add(IDC_NOSOUND_CTRL, 0, wxRIGHT, 0);
00126         soundSizer1->Add(new wxStaticText(parent, -1, wxT("")), 0, wxRIGHT, 0);
00127         soundSizer1->Add(musicVolumeText, 0, wxRIGHT, 10);
00128         soundSizer1->Add(IDC_MUSICVOLUME_CTRL, 0, wxRIGHT, 10);
00129         soundSizer1->Add(IDC_NOMUSIC_CTRL, 0, wxRIGHT, 0);
00130         soundSizerMain->Add(soundSizer1, 0, wxGROW | wxTOP, 5);
00131         sizer->Add(soundSizerMain, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
00132         }
00133 
00134         {
00135         // Load settings
00136         wxStaticBox *speedBox = new wxStaticBox(parent, -1, 
00137                 wxT("Game Speed Options"));
00138         wxStaticBoxSizer *speedSizer = new wxStaticBoxSizer(speedBox, wxHORIZONTAL);
00139 
00140         wxGridSizer *loadSizer = new wxFlexGridSizer(2, 2);
00141         IDC_LOADDEFAULTS_CTRL = new wxButton(parent, ID_LOADDEFAULTS, wxT("&Normal Settings"), wxDefaultPosition, wxSize(120,-1));
00142         IDC_LOADMEDIUM_CTRL = new wxButton(parent, ID_LOADMEDIUM, wxT("Faster Settings"), wxDefaultPosition, wxSize(120,-1));
00143         IDC_LOADFASTEST_CTRL = new wxButton(parent, ID_LOADFASTEST, wxT("Fastest Settings"), wxDefaultPosition, wxSize(120,-1));
00144         IDC_LOADSAFE_CTRL = new wxButton(parent, ID_LOADSAFE, wxT("Safe Options"), wxDefaultPosition, wxSize(120,-1));
00145         loadSizer->Add(IDC_LOADDEFAULTS_CTRL, 0, wxALL, 2);
00146         loadSizer->Add(new wxStaticText(parent, -1, wxT("Load the normal starting settings for Scorched3D. (FAST machines)")),
00147                 0, wxALL, 2);
00148         loadSizer->Add(IDC_LOADMEDIUM_CTRL, 0, wxALL, 2);
00149         loadSizer->Add(new wxStaticText(parent, -1, wxT("Load a faster set of settings for Scorched3D. (MEDIUM machines)\n"
00150                 "Note: This will result in a slightly reduced graphical experience.")),
00151                 0, wxALL, 2);
00152         loadSizer->Add(IDC_LOADFASTEST_CTRL, 0, wxALL, 2);
00153         loadSizer->Add(new wxStaticText(parent, -1, wxT("Load the fastest settings for Scorched3D. (SLOW machines)\n"
00154                 "Note: This will result in a greatly reduced graphical and audio experience.")),
00155                 0, wxALL, 2);
00156         loadSizer->Add(IDC_LOADSAFE_CTRL, 0, wxALL, 2);
00157         loadSizer->Add(new wxStaticText(parent, -1, wxT("Load the safest settings for Scorched3D.\n"
00158                 "Note: This will result in a greatly reduced overall experience but may prevent crashes.")),
00159                 0, wxALL, 2);
00160 
00161         speedSizer->Add(loadSizer, 0, wxGROW);
00162         sizer->Add(speedSizer, 0, wxGROW | wxTOP | wxALIGN_CENTER, 5);
00163         }
00164 }
00165 
00166 static void createOtherControls(wxWindow *parent, wxSizer *sizer)
00167 {
00168         {
00169         // Misc switches 
00170         wxStaticBox *miscBox = new wxStaticBox(parent, -1, 
00171                 wxT("Misc. Options"));
00172         wxStaticBoxSizer *miscSizer = new wxStaticBoxSizer(miscBox, wxHORIZONTAL);
00173         wxGridSizer *miscSizer2 = new wxGridSizer(3, 3, 10, 10);
00174         IDC_INVERT_CTRL = 
00175                 new wxCheckBox(parent, -1, wxT("Invert key elevation"));
00176         miscSizer2->Add(IDC_INVERT_CTRL, 0);
00177         IDC_INVERTMOUSE_CTRL = 
00178                 new wxCheckBox(parent, -1, wxT("Invert mouse elevation"));
00179         miscSizer2->Add(IDC_INVERTMOUSE_CTRL, 0);
00180         //IDC_SWAPYAXIS_CTRL = 
00181         //      new wxCheckBox(parent, -1, wxT("Invert mouse y axis (OS X)"));
00182         //miscSizer2->Add(IDC_SWAPYAXIS_CTRL, 0);
00183         IDC_TIMER_CTRL = 
00184                 new wxCheckBox(parent, -1, wxT("Show frames per second"));
00185         miscSizer2->Add(IDC_TIMER_CTRL, 0);
00186         IDC_SMOUSE_CTRL = 
00187                 new wxCheckBox(parent, -1, wxT("Software Mouse"));
00188         miscSizer2->Add(IDC_SMOUSE_CTRL, 0);
00189         IDC_VALIDATESERVER_CTRL = 
00190                 new wxCheckBox(parent, -1, wxT("Validate Server Ip"));
00191         miscSizer2->Add(IDC_VALIDATESERVER_CTRL, 0);
00192         IDC_SIDESCROLL_CTRL = 
00193                 new wxCheckBox(parent, -1, wxT("Side Scrolling"));
00194         miscSizer2->Add(IDC_SIDESCROLL_CTRL, 0);
00195         IDC_PLAYERCAMERA_CTRL = 
00196                 new wxCheckBox(parent, -1, wxT("Remember camera pos"));
00197         miscSizer2->Add(IDC_PLAYERCAMERA_CTRL, 0);
00198         IDC_LOGGING_CTRL = 
00199                 new wxCheckBox(parent, -1, wxT("Client Logging"));
00200         miscSizer2->Add(IDC_LOGGING_CTRL, 0);
00201         miscSizer->Add(miscSizer2, 0, wxGROW);
00202         sizer->Add(miscSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
00203         }
00204 }
00205 
00206 static void createTroubleControls(wxWindow *parent, wxSizer *sizer)
00207 {
00208         // Texture sizes (small med large)
00209         wxStaticBox *textureBox = new wxStaticBox(parent, -1, wxT("Level of Detail settings"));
00210         wxStaticBoxSizer *textureSizer = new wxStaticBoxSizer(textureBox, wxHORIZONTAL);
00211         wxGridSizer *textureSizer2 = new wxGridSizer(3, 4, 10, 10);
00212         wxStaticText *texSizeText = new wxStaticText(parent, -1, wxT("Texture Sizes :"));
00213         textureSizer2->Add(texSizeText, 0, wxALIGN_CENTER_VERTICAL);
00214         IDC_SMALLTEX_CTRL = new wxRadioButton(parent, -1, wxT("Small (3dfx/faster)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
00215         textureSizer2->Add(IDC_SMALLTEX_CTRL, 0);
00216         IDC_MEDIUMTEX_CTRL = new wxRadioButton(parent, -1, wxT("Medium"));
00217         textureSizer2->Add(IDC_MEDIUMTEX_CTRL, 0);
00218         IDC_LARGETEX_CTRL = new wxRadioButton(parent, -1, wxT("Large (slower)"));
00219         textureSizer2->Add(IDC_LARGETEX_CTRL, 0);
00220         wxStaticText *tankSizeText = new wxStaticText(parent, -1, wxT("Tank Detail :"));
00221         textureSizer2->Add(tankSizeText, 0, wxALIGN_CENTER_VERTICAL);
00222         IDC_LOWTANK_CTRL = new wxRadioButton(parent, -1, wxT("Low (faster)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
00223         textureSizer2->Add(IDC_LOWTANK_CTRL, 0);
00224         IDC_MEDIUMTANK_CTRL = new wxRadioButton(parent, -1, wxT("Medium"));
00225         textureSizer2->Add(IDC_MEDIUMTANK_CTRL, 0);
00226         IDC_HIGHTANK_CTRL = new wxRadioButton(parent, -1, wxT("Max (slower)"));
00227         textureSizer2->Add(IDC_HIGHTANK_CTRL, 0);
00228         wxStaticText *effectSizeText = new wxStaticText(parent, -1, wxT("Effects Detail :"));
00229         textureSizer2->Add(effectSizeText, 0, wxALIGN_CENTER_VERTICAL);
00230         IDC_LOWEFFECTS_CTRL = new wxRadioButton(parent, -1, wxT("Low (faster)"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
00231         textureSizer2->Add(IDC_LOWEFFECTS_CTRL, 0);
00232         IDC_MEDIUMEFFECTS_CTRL = new wxRadioButton(parent, -1, wxT("Medium"));
00233         textureSizer2->Add(IDC_MEDIUMEFFECTS_CTRL, 0);
00234         IDC_HIGHEFFECTS_CTRL = new wxRadioButton(parent, -1, wxT("High (slower)"));
00235         textureSizer2->Add(IDC_HIGHEFFECTS_CTRL, 0);
00236         textureSizer->Add(textureSizer2, 0, wxGROW);
00237         sizer->Add(textureSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
00238 
00239         // Detail switches 
00240         {
00241                 wxStaticBox *waterDetailBox = new wxStaticBox(parent, -1, 
00242                         wxT("Graphics Detail"));
00243                 wxStaticBoxSizer *waterDetailSizer = new wxStaticBoxSizer(waterDetailBox, wxHORIZONTAL);
00244                 wxGridSizer *waterDetailSizer2 = new wxGridSizer(3, 1, 10, 10);
00245 
00246                 IDC_NOWATERREF_CTRL = 
00247                         new wxCheckBox(parent, -1, wxT("Don't draw water reflections - Large Framerate Improvement"));
00248                 waterDetailSizer2->Add(IDC_NOWATERREF_CTRL, 0);
00249                 IDC_NOWATERMOVEMENT_CTRL = 
00250                         new wxCheckBox(parent, -1, wxT("Don't draw water movement - Large Framerate Improvement"));
00251                 waterDetailSizer2->Add(IDC_NOWATERMOVEMENT_CTRL, 0);
00252                 IDC_NOWATER_CTRL = 
00253                         new wxCheckBox(parent, -1, wxT("Don't draw water - Large Framerate Improvement"));
00254                 waterDetailSizer2->Add(IDC_NOWATER_CTRL, 0);
00255                 IDC_NOWATERWAVES_CTRL = 
00256                         new wxCheckBox(parent, -1, wxT("Don't draw water breakers - Small Loading Speed Improvement"));
00257                 waterDetailSizer2->Add(IDC_NOWATERWAVES_CTRL, 0);
00258                 IDC_NOWATERLOD_CTRL = 
00259                         new wxCheckBox(parent, -1, wxT("Draw simplistic water - Medium Framerate Improvement"));
00260                 waterDetailSizer2->Add(IDC_NOWATERLOD_CTRL, 0);
00261                 IDC_NOSHADERS_CTRL = 
00262                         new wxCheckBox(parent, -1, wxT("No GL shaders - Large Framerate Improvement"));
00263                 waterDetailSizer2->Add(IDC_NOSHADERS_CTRL, 0);
00264                 IDC_SIMPLEWATERSHADERS_CTRL = 
00265                         new wxCheckBox(parent, -1, wxT("Simple water shaders - Medium Framerate Improvement"));
00266                 waterDetailSizer2->Add(IDC_SIMPLEWATERSHADERS_CTRL, 0);
00267                 IDC_NOOBJECTSHADOWS_CTRL = 
00268                         new wxCheckBox(parent, -1, wxT("No GL shadows for objects - Medium Framerate Improvement"));
00269                 waterDetailSizer2->Add(IDC_NOOBJECTSHADOWS_CTRL, 0);
00270                 IDC_NOSHADOWS_CTRL = 
00271                         new wxCheckBox(parent, -1, wxT("No GL shadows - Large Framerate Improvement"));
00272                 waterDetailSizer2->Add(IDC_NOSHADOWS_CTRL, 0);
00273 
00274                 waterDetailSizer->Add(waterDetailSizer2, 0, wxGROW);
00275                 sizer->Add(waterDetailSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
00276         }
00277 
00278         // Graphics Settings
00279         {
00280                 wxStaticBox *glDetailBox = new wxStaticBox(parent, -1, 
00281                         wxT("Compatability Settings"));
00282                 wxStaticBoxSizer *glDetailSizer = new wxStaticBoxSizer(glDetailBox, wxHORIZONTAL);
00283                 wxGridSizer *glDetailSizer2 = new wxGridSizer(3, 3, 10, 10);
00284 
00285                 IDC_NOEXT_CTRL = 
00286                         new wxCheckBox(parent, -1, wxT("No GL Extensions"));
00287                 glDetailSizer2->Add(IDC_NOEXT_CTRL, 0);
00288                 IDC_NOMULTITEX_CTRL = 
00289                         new wxCheckBox(parent, -1, wxT("No multi texture"));
00290                 glDetailSizer2->Add(IDC_NOMULTITEX_CTRL, 0);
00291                 IDC_NOLANDSCAPESCORCH_CTRL = 
00292                         new wxCheckBox(parent, -1, wxT("No TexSubImaging"));
00293                 glDetailSizer2->Add(IDC_NOLANDSCAPESCORCH_CTRL, 0);
00294                 IDC_NOENVCOMBINE_CTRL = 
00295                         new wxCheckBox(parent, -1, wxT("No combined textures"));
00296                 glDetailSizer2->Add(IDC_NOENVCOMBINE_CTRL, 0);
00297                 IDC_NOCUBEMAP_CTRL = 
00298                         new wxCheckBox(parent, -1, wxT("No cube map"));
00299                 glDetailSizer2->Add(IDC_NOCUBEMAP_CTRL, 0);
00300                 IDC_NOSPHEREMAP_CTRL = 
00301                         new wxCheckBox(parent, -1, wxT("No sphere map"));
00302                 glDetailSizer2->Add(IDC_NOSPHEREMAP_CTRL, 0);
00303                 IDC_NOMIPMAPS_CTRL = 
00304                         new wxCheckBox(parent, -1, wxT("No HW mip maps"));
00305                 glDetailSizer2->Add(IDC_NOMIPMAPS_CTRL, 0);
00306                 IDC_NOVBO_CTRL = 
00307                         new wxCheckBox(parent, -1, wxT("No VBO"));
00308                 glDetailSizer2->Add(IDC_NOVBO_CTRL, 0);
00309 
00310                 glDetailSizer->Add(glDetailSizer2, 0, wxGROW);
00311                 sizer->Add(glDetailSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
00312         }
00313 
00314         {
00315                 wxStaticBox *miscDetailBox = new wxStaticBox(parent, -1, 
00316                         wxT("Misc Detail"));
00317                 wxStaticBoxSizer *miscDetailSizer = new wxStaticBoxSizer(miscDetailBox, wxHORIZONTAL);
00318                 wxGridSizer *miscDetailSizer2 = new wxGridSizer(3, 3, 10, 10);
00319 
00320                 IDC_NODETAILTEX_CTRL = 
00321                         new wxCheckBox(parent, -1, wxT("Don't use detail textures"));
00322                 miscDetailSizer2->Add(IDC_NODETAILTEX_CTRL, 0);
00323                 IDC_NOSURROUND_CTRL = 
00324                         new wxCheckBox(parent, -1, wxT("Don't draw surround"));
00325                 miscDetailSizer2->Add(IDC_NOSURROUND_CTRL, 0);
00326                 IDC_SINGLESKYLAYER_CTRL = 
00327                         new wxCheckBox(parent, -1, wxT("Single sky layer"));
00328                 miscDetailSizer2->Add(IDC_SINGLESKYLAYER_CTRL, 0);
00329                 IDC_NOSKYANI_CTRL = 
00330                         new wxCheckBox(parent, -1, wxT("Don't animate sky"));
00331                 miscDetailSizer2->Add(IDC_NOSKYANI_CTRL, 0);
00332                 IDC_NOSKINS_CTRL = 
00333                         new wxCheckBox(parent, -1, wxT("No model skins"));
00334                 miscDetailSizer2->Add(IDC_NOSKINS_CTRL, 0);
00335                 IDC_NODYNAMICLIGHT_CTRL = 
00336                         new wxCheckBox(parent, -1, wxT("No model dynamic lighting"));
00337                 miscDetailSizer2->Add(IDC_NODYNAMICLIGHT_CTRL, 0);
00338                 IDC_NOPRECIPITATION_CTRL = 
00339                         new wxCheckBox(parent, -1, wxT("No precipitation"));
00340                 miscDetailSizer2->Add(IDC_NOPRECIPITATION_CTRL, 0);
00341                 IDC_NODEPTHSORT_CTRL = 
00342                         new wxCheckBox(parent, -1, wxT("No sprite depth sorting"));
00343                 miscDetailSizer2->Add(IDC_NODEPTHSORT_CTRL, 0);
00344                 IDC_NOBACKDROP_CTRL = 
00345                         new wxCheckBox(parent, -1, wxT("No progress backdrop"));
00346                 miscDetailSizer2->Add(IDC_NOBACKDROP_CTRL, 0);
00347 
00348                 miscDetailSizer->Add(miscDetailSizer2, 0, wxGROW);
00349                 sizer->Add(miscDetailSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
00350         }
00351 }
00352 
00353 static void createIdentControls(wxWindow *parent, wxSizer *sizer)
00354 {
00355         {
00356         // User name edit box
00357         wxStaticBox *userNameBox = new wxStaticBox(parent, -1, 
00358                 wxT("Online User Name"));
00359         wxStaticBoxSizer *userNameSizer = new wxStaticBoxSizer(userNameBox, wxVERTICAL);
00360         IDC_USERNAME_CTRL = new wxTextCtrl(parent, -1, wxString(), wxDefaultPosition, wxSize(300, -1));
00361         userNameSizer->Add(IDC_USERNAME_CTRL, 0, wxALIGN_CENTER);
00362         sizer->Add(userNameSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
00363         }
00364 
00365         {
00366         // TankModel edit box
00367         wxStaticBox *tankModelBox = new wxStaticBox(parent, -1, 
00368                 wxT("Online Tank Model"));
00369         wxStaticBoxSizer *tankModelSizer = new wxStaticBoxSizer(tankModelBox, wxVERTICAL);
00370         IDC_TANKMODEL_CTRL = new wxTextCtrl(parent, -1, wxString(), wxDefaultPosition, wxSize(300, -1));
00371         tankModelSizer->Add(IDC_TANKMODEL_CTRL, 0, wxALIGN_CENTER);
00372         sizer->Add(tankModelSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
00373         }
00374 
00375         // User id edit box
00376         wxStaticBox *userBox = new wxStaticBox(parent, -1, 
00377                 wxT("User ID (Uniquely identifies this player for stats, not generated from any user information.)"));
00378         wxStaticBoxSizer *userSizer = new wxStaticBoxSizer(userBox, wxVERTICAL);
00379         IDC_USERID_CTRL = new wxGrid(parent, -1, wxDefaultPosition, wxDefaultSize);
00380         IDC_USERID_CTRL->CreateGrid(0, 3);
00381         IDC_USERID_CTRL->SetColLabelValue(0, wxT("Published Ip"));
00382         IDC_USERID_CTRL->SetColLabelValue(1, wxT("Current Ip"));
00383         IDC_USERID_CTRL->SetColLabelValue(2, wxT("Unique Id"));
00384         IDC_USERID_CTRL->SetColLabelSize(20);
00385         IDC_USERID_CTRL->SetRowLabelSize(0);
00386 
00387         userSizer->Add(IDC_USERID_CTRL, 1, wxALIGN_CENTER | wxGROW);
00388         IDC_HOSTDESC_CTRL = new wxTextCtrl(parent, -1, wxString(), wxDefaultPosition, wxSize(300, -1), wxTE_READONLY);
00389         userSizer->Add(IDC_HOSTDESC_CTRL, 0, wxALIGN_CENTER);
00390         sizer->Add(userSizer, 1, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5);
00391 }
00392 
00393 static void refreshIdentControls()
00394 {
00395         UniqueIdStore idStore;
00396         idStore.loadStore();
00397 
00398         if (int(idStore.getIds().size()) > IDC_USERID_CTRL->GetNumberRows())
00399         {
00400                 IDC_USERID_CTRL->AppendRows(
00401                         int(idStore.getIds().size()) - IDC_USERID_CTRL->GetNumberRows());
00402         }
00403 
00404         // User id edit box
00405         int pos = 0;
00406         IDC_USERID_CTRL->ClearGrid();
00407         std::list<UniqueIdStore::Entry>::iterator itor;
00408         for (itor = idStore.getIds().begin();
00409                 itor != idStore.getIds().end();
00410                 itor++, pos++)
00411         {
00412                 UniqueIdStore::Entry &entry = *itor;
00413                 IDC_USERID_CTRL->SetCellValue(pos, 0, wxString(entry.published.c_str(), wxConvUTF8));
00414                 IDC_USERID_CTRL->SetCellValue(pos, 1, wxString(NetInterface::getIpName(entry.ip), wxConvUTF8));
00415                 IDC_USERID_CTRL->SetCellValue(pos, 2, wxString(entry.id.c_str(), wxConvUTF8));
00416                 IDC_USERID_CTRL->SetReadOnly(pos, 0);
00417                 IDC_USERID_CTRL->SetReadOnly(pos, 1);
00418         }
00419         IDC_USERID_CTRL->EnableEditing(true);
00420         IDC_USERID_CTRL->AutoSizeColumns(true);
00421         IDC_USERID_CTRL->ForceRefresh();
00422 }
00423 
00424 class KeyButtonData : public wxObjectRefData
00425 {
00426 public:
00427         KeyButtonData(const char *key, unsigned int position);
00428         virtual ~KeyButtonData();
00429 
00430         std::string key_;
00431         unsigned int position_;
00432 };
00433 
00434 KeyButtonData::KeyButtonData(const char *key, unsigned int position) :
00435         wxObjectRefData(),
00436         key_(key), position_(position)
00437 {
00438 }
00439 
00440 KeyButtonData::~KeyButtonData()
00441 {
00442 }
00443 
00444 static std::list<wxButton *> keyboardKeyList;
00445 
00446 static void createKeysControls(wxWindow *parent, wxSizer *topsizer)
00447 {
00448         wxScrolledWindow *scrolledWindow = new wxScrolledWindow(parent, -1, 
00449                 wxDefaultPosition, wxSize(480, 250));
00450         wxSizer *sizer = new wxFlexGridSizer(5, 1);
00451         
00452         keyboardKeyList.clear();
00453         if (!Keyboard::instance()->loadKeyFile())
00454         {
00455                 S3D::dialogExit("Keyboard", "Failed to process keyboad file keys.xml");
00456         }
00457 
00458         int lastGroup = 0;
00459         std::list<std::string> &keys = 
00460                 Keyboard::instance()->getKeyList();
00461         std::list<std::string>::iterator itor;
00462         for (itor = keys.begin();
00463                 itor != keys.end();
00464                 itor++)
00465         {
00466                 KeyboardKey *key = Keyboard::instance()->getKey((*itor).c_str());
00467 
00468                 // Add a spacer line
00469                 if (key->getGroup() != lastGroup)
00470                 {
00471                         lastGroup = key->getGroup();
00472                         for (unsigned int i=0; i<5; i++)
00473                         {
00474                                 sizer->Add(new wxStaticText(
00475                                         scrolledWindow, -1, wxString("", wxConvUTF8)), 0, wxALIGN_LEFT);
00476                         }
00477                 }
00478 
00479                 // Add the key name
00480                 wxStaticText *text = new wxStaticText(
00481                         scrolledWindow, -1, wxString(key->getTitle(), wxConvUTF8));
00482                 text->SetToolTip(wxString(key->getDescription(), wxConvUTF8));
00483                 sizer->Add(text, 0, wxALIGN_LEFT);
00484 
00485                 // Add the keys
00486                 for (unsigned int i=0; i<4; i++)
00487                 {
00488                         wxButton *button = new wxButton(scrolledWindow, ID_KEY, wxT(""), 
00489                                 wxDefaultPosition, wxSize(120, -1));
00490                         button->SetRefData(new KeyButtonData(key->getName(), i));
00491                         button->SetToolTip(wxString(key->getDescription(), wxConvUTF8));
00492                         sizer->Add(button, 0, wxLEFT | wxALIGN_CENTER, 5);
00493                         keyboardKeyList.push_back(button);
00494                 }
00495         }
00496         
00497         // Setup the scrolled area size
00498         scrolledWindow->SetAutoLayout(TRUE);
00499         scrolledWindow->SetSizer(sizer);
00500         wxSize minSize = sizer->CalcMin();
00501         scrolledWindow->SetScrollbars(10, 10, 
00502                 (minSize.GetWidth() + 10) / 10, (minSize.GetHeight() + 10) / 10);
00503         topsizer->Add(scrolledWindow, 1, wxGROW | wxALL | wxALIGN_CENTER, 2);
00504 
00505         // Add the load default keys button
00506         IDC_LOADKEYDEFAULTS_CTRL = new wxButton(parent, ID_KEYDEFAULTS, wxT("Load Default Keys"));
00507         topsizer->Add(IDC_LOADKEYDEFAULTS_CTRL, 0, wxCENTER | wxALL, 2);
00508 }
00509 
00510 static wxListBox *modbox = 0;
00511 static void updateModList()
00512 {
00513         modbox->Clear();
00514         ModDirs dirs;
00515         if (dirs.loadModDirs())
00516         {
00517                 std::list<ModInfo>::iterator itor;
00518                 for (itor = dirs.getDirs().begin();
00519                         itor != dirs.getDirs().end();
00520                         itor++)
00521                 {
00522                         ModInfo &info = (*itor);
00523                         modbox->Append(wxString(info.getName(), wxConvUTF8));
00524                 }
00525         }
00526 }
00527 
00528 static void createModsControls(wxWindow *parent, wxSizer *topsizer)
00529 {
00530         wxStaticBox *modsBox = new wxStaticBox(parent, -1, wxT("Mods"));
00531         wxStaticBoxSizer *modsSizer = new wxStaticBoxSizer(modsBox, wxVERTICAL);
00532 
00533         modbox = new wxListBox(parent, -1, 
00534                 wxDefaultPosition, wxSize(150, 200), 0, 0, wxLB_SINGLE);
00535         updateModList();
00536         modsSizer->Add(modbox, 0, wxALIGN_CENTER | wxALL, 5);
00537 
00538         wxBoxSizer *buttonSizer = new wxBoxSizer(wxHORIZONTAL);
00539         wxButton *exportBut = new wxButton(parent, ID_EXPORT, wxT("Export"));
00540         wxButton *importBut = new wxButton(parent, ID_IMPORT, wxT("Import"));
00541         buttonSizer->Add(exportBut, 0, wxRIGHT, 5);
00542         buttonSizer->Add(importBut, 0, wxLEFT, 5);
00543         modsSizer->Add(buttonSizer, 0, wxALIGN_CENTER);
00544         
00545         topsizer->Add(modsSizer, 0, wxGROW);    
00546 }
00547 

Generated on Mon Feb 16 15:14:46 2009 for Scorched3D by  doxygen 1.5.3