Changeset 132
- Timestamp:
- 08/26/10 18:14:55 (18 months ago)
- Location:
- cafu/branches/cafu_to_wx
- Files:
-
- 4 modified
-
Ca3DE/AppCafu.cpp (modified) (3 diffs)
-
Ca3DE/ConDefs.cpp (modified) (1 diff)
-
Ca3DE/MainCanvas.cpp (modified) (2 diffs)
-
Games/DeathMatch/GUIs/MainMenu/MainMenu_main.cgui (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cafu/branches/cafu_to_wx/Ca3DE/AppCafu.cpp
r131 r132 27 27 #include "ClipSys/CollisionModelMan_impl.hpp" 28 28 #include "ConsoleCommands/ConsoleInterpreterImpl.hpp" 29 #include "ConsoleCommands/ConsoleSt dout.hpp"29 #include "ConsoleCommands/ConsoleStringBuffer.hpp" 30 30 #include "ConsoleCommands/ConVar.hpp" 31 31 #include "ConsoleCommands/ConFunc.hpp" … … 48 48 // For each interface that is globally available to the application, 49 49 // provide a definition for the pointer instance and have it point to an implementation. 50 static cf::ConsoleSt doutT ConsoleStdout;51 cf::ConsoleI* Console=&ConsoleSt dout;52 53 // static cf::ConsoleFileT ConsoleFile(" info.log");50 static cf::ConsoleStringBufferT ConsoleStringBuffer; 51 cf::ConsoleI* Console=&ConsoleStringBuffer; 52 53 // static cf::ConsoleFileT ConsoleFile("console.log"); 54 54 // cf::ConsoleI* Console=&ConsoleFile; 55 55 … … 203 203 wxString::Format(" %i x %i at any color depth and refresh rate,\n", VideoMode3.w, VideoMode3.h)+ 204 204 "but it didn't work out (zero values mean system defaults).\n"+ 205 "We will use the currently active video mode instead and continue.\n\n"+205 "We will continue with the currently active video mode instead, where you can press F11 to toggle full-screen mode.\n\n"+ 206 206 "Alternatively, you can set a different video mode at the Options menu,\n"+ 207 207 "or tweak the video mode details via the console variables.\n", -
cafu/branches/cafu_to_wx/Ca3DE/ConDefs.cpp
r130 r132 62 62 /*static*/ ConVarT Options_ClientRemoteName ("dlg_clRemoteName", "192.168.1.1", ConVarT::FLAG_MAIN_EXE | ConVarT::FLAG_PERSISTENT, "Name or IP of the server the client connects to."); 63 63 /*static*/ ConVarT Options_ClientRemotePortNr ("dlg_clRemotePort", 30000, ConVarT::FLAG_MAIN_EXE | ConVarT::FLAG_PERSISTENT, "Port number of the remote server.", 0, 0xFFFF); 64 /*static*/ ConVarT Options_ClientDisplayBPP ("dlg_clDisplayBPP", 32, ConVarT::FLAG_MAIN_EXE ,"The display depth in bits-per-pixel. Normally use 32, or 0 for system default.", 0, 64);65 /*static*/ ConVarT Options_ClientDisplayRefresh ("dlg_clDisplayRefresh", 0, ConVarT::FLAG_MAIN_EXE ,"The display refresh rate. Use 0 for system default, check with your monitor specs for any other value.");64 /*static*/ ConVarT Options_ClientDisplayBPP ("dlg_clDisplayBPP", 32, ConVarT::FLAG_MAIN_EXE | ConVarT::FLAG_PERSISTENT, "The display depth in bits-per-pixel. Normally use 32, or 0 for system default.", 0, 64); 65 /*static*/ ConVarT Options_ClientDisplayRefresh ("dlg_clDisplayRefresh", 0, ConVarT::FLAG_MAIN_EXE | ConVarT::FLAG_PERSISTENT, "The display refresh rate. Use 0 for system default, check with your monitor specs for any other value."); 66 66 /*static*/ ConVarT Options_ClientTextureDetail ("dlg_clTextureDetail", 0, ConVarT::FLAG_MAIN_EXE | ConVarT::FLAG_PERSISTENT, "0 high detail, 1 medium detail, 2 low detail", 0, 2); 67 67 /*static*/ ConVarT Options_ServerGameName ("dlg_svGameName", "DeathMatch", ConVarT::FLAG_MAIN_EXE, "Name of the game (MOD) to load."); -
cafu/branches/cafu_to_wx/Ca3DE/MainCanvas.cpp
r131 r132 33 33 #include "ConsoleCommands/Console.hpp" 34 34 #include "ConsoleCommands/ConsoleInterpreter.hpp" 35 #include "ConsoleCommands/ConsoleStringBuffer.hpp" 35 36 #include "ConsoleCommands/ConVar.hpp" 36 37 #include "GuiSys/ConsoleByWindow.hpp" … … 438 439 m_PrevConsole=Console; 439 440 Console=m_ConByGuiWin; 441 442 // Copy the output to the previous console to the now current console. 443 cf::ConsoleStringBufferT* ConsoleSB=dynamic_cast<cf::ConsoleStringBufferT*>(m_PrevConsole); 444 if (ConsoleSB) Console->Print(ConsoleSB->GetBuffer()); 440 445 441 446 m_InitState=INIT_SUCCESS; -
cafu/branches/cafu_to_wx/Games/DeathMatch/GUIs/MainMenu/MainMenu_main.cgui
r36 r132 19 19 20 20 return ""; 21 end 22 23 -- Parses a string that describes a video mode. It returns the width, height, colour depth and refresh rate. 24 function ParseModeStr(ModeStr) 25 -- For case-insensitive matching, translate the entire string to lower case. 26 ModeStr=ModeStr:lower(); 27 28 local width, height=ModeStr:match("(%d+)%s*x%s*(%d+)"); 29 local bpp =ModeStr:match("(%d+)%s*bpp"); 30 local rate =ModeStr:match("(%d+)%s*hz"); 31 32 if width then width =tonumber(width); end 33 if height then height=tonumber(height); end 34 if bpp then bpp =tonumber(bpp); end 35 if rate then rate =tonumber(rate); end 36 37 return width, height, bpp, rate; 21 38 end 22 39 … … 544 561 545 562 function OptionsContextMenu.Frame.Video:OnMouseButtonUp() 546 -- Select the first screen resolution that is at least as wide as "dlg_clWindowSizeX" (1024*768 is used as a fall-back).547 VideoOptionsDialog.Frame.ScreenResChoice:SetSelection( 2); -- Safety if the loop below fails for some reason.563 -- Select the screen resolution that matches the one specified in the console variables. 564 VideoOptionsDialog.Frame.ScreenResChoice:SetSelection(0); -- Safety if the loop below fails for some reason. 548 565 549 566 for ModeNr=0, VideoOptionsDialog.Frame.ScreenResChoice:GetNumChoices()-1 do 550 local ResX=tonumber(VideoOptionsDialog.Frame.ScreenResChoice:GetChoice(ModeNr):match("%d+")); 551 552 if (ResX>=ci.GetValue("dlg_clWindowSizeX")) then 567 local width, height, bpp, rate=ParseModeStr(VideoOptionsDialog.Frame.ScreenResChoice:GetChoice(ModeNr)); 568 569 if width==ci.GetValue("dlg_clWindowSizeX") and height==ci.GetValue("dlg_clWindowSizeY") then 570 -- The width and height match, select this mode. 553 571 VideoOptionsDialog.Frame.ScreenResChoice:SetSelection(ModeNr); 554 break; 572 573 if bpp==ci.GetValue("dlg_clDisplayBPP") and rate==ci.GetValue("dlg_clDisplayRefresh") then 574 -- The color depth and refresh rate match, too - stop looking for a better match. 575 break; 576 end 555 577 end 556 578 end … … 1160 1182 -- Move into OnInit()? 1161 1183 VideoOptionsDialog.Frame.ScreenResChoice:Clear(); 1162 VideoOptionsDialog.Frame.ScreenResChoice:Append(" 640 x 480"); 1163 VideoOptionsDialog.Frame.ScreenResChoice:Append(" 800 x 600"); 1164 VideoOptionsDialog.Frame.ScreenResChoice:Append(" 1024 x 768"); 1165 VideoOptionsDialog.Frame.ScreenResChoice:Append(" 1152 x 864"); 1166 VideoOptionsDialog.Frame.ScreenResChoice:Append(" 1280 x 1024"); 1167 VideoOptionsDialog.Frame.ScreenResChoice:Append(" 1600 x 1200"); 1168 VideoOptionsDialog.Frame.ScreenResChoice:SetSelection(2); -- Set again when the dialog is shown. 1184 1185 -- For each video mode in console variable "VideoModes" (a multi-line string with one 1186 -- video mode per line, separated by new-lines), append a choice to the choice window. 1187 for ModeStr in ci.GetValue("VideoModes"):gmatch("[^\n]+") do 1188 VideoOptionsDialog.Frame.ScreenResChoice:Append(" "..ModeStr); 1189 end 1190 1191 -- It is possible (though normally not necessary) to add custom video modes here, 1192 -- for example when your favorite video mode is not automatically detected and provided above. 1193 -- There is no guarantee though that the graphics driver can set any custom modes 1194 -- (or else the mode had been automatically included in the enumeration above). 1195 -- Examples: 1196 -- VideoOptionsDialog.Frame.ScreenResChoice:Append(" 1152 x 864"); 1197 -- VideoOptionsDialog.Frame.ScreenResChoice:Append(" 1440 x 900, 32 bpp, 60 Hz"); 1198 1199 -- The list of video modes above should never be totally empty, 1200 -- but still just handle the case here to be totally sure. 1201 if (VideoOptionsDialog.Frame.ScreenResChoice:GetNumChoices()==0) then 1202 Console.Warning("Console variable VideoModes is empty!"); 1203 1204 VideoOptionsDialog.Frame.ScreenResChoice:Append(" 640 x 480"); 1205 VideoOptionsDialog.Frame.ScreenResChoice:Append(" 800 x 600"); 1206 VideoOptionsDialog.Frame.ScreenResChoice:Append(" 1024 x 768"); 1207 end 1208 1209 VideoOptionsDialog.Frame.ScreenResChoice:SetSelection(0); -- Set again when the dialog is shown. 1169 1210 1170 1211 function VideoOptionsDialog.Frame.ScreenResChoice:OnSelectionChanged(SelNum) … … 1215 1256 local ModeStr=VideoOptionsDialog.Frame.ScreenResChoice:GetChoice(ModeNr); 1216 1257 1217 local ResX, ResY=ModeStr:match("(%d+)%s*x%s*(%d+)"); 1218 1219 ci.SetValue("dlg_clWindowSizeX", ResX); 1220 ci.SetValue("dlg_clWindowSizeY", ResY); 1258 local width, height, bpp, rate=ParseModeStr(ModeStr); 1259 1260 if width then ci.SetValue("dlg_clWindowSizeX", width ); end 1261 if height then ci.SetValue("dlg_clWindowSizeY", height); end 1262 if bpp then ci.SetValue("dlg_clDisplayBPP", bpp ); end 1263 if rate then ci.SetValue("dlg_clDisplayRefresh", rate ); end 1264 1221 1265 ci.SetValue("dlg_clFullScreen", VideoOptionsDialog.Frame.FullScreenChoice:GetSelection()==1); 1222 1266 ci.SetValue("dlg_clTextureDetail", VideoOptionsDialog.Frame.TextureDetailChoice:GetSelection());
