Changeset 116
- Timestamp:
- 08/13/10 22:27:00 (18 months ago)
- Location:
- cafu/branches/cafu_to_wx
- Files:
-
- 8 added
- 4 modified
-
Ca3DE/AppCafu.cpp (added)
-
Ca3DE/AppCafu.hpp (added)
-
Ca3DE/Client/ClientStateInGame.cpp (modified) (18 diffs)
-
Ca3DE/Client/Graphs.cpp (modified) (5 diffs)
-
Ca3DE/ConDefs.cpp (added)
-
Ca3DE/ConDefs.hpp (added)
-
Ca3DE/MainCanvas.cpp (added)
-
Ca3DE/MainCanvas.hpp (added)
-
Ca3DE/MainFrame.cpp (added)
-
Ca3DE/MainFrame.hpp (added)
-
CompilerSetup.py.tmpl (modified) (2 diffs)
-
SConscript (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cafu/branches/cafu_to_wx/Ca3DE/Client/ClientStateInGame.cpp
r48 r116 22 22 */ 23 23 24 #include "../AppCafu.hpp" 25 #include "../MainCanvas.hpp" 26 #include "../MainFrame.hpp" 27 #include "../NetConst.hpp" 28 24 29 #include "ClientStateInGame.hpp" 25 30 #include "Client.hpp" … … 27 32 #include "PathRecorder.hpp" 28 33 29 #include "../NetConst.hpp"30 34 #include "GuiSys/Gui.hpp" 31 35 #include "GuiSys/GuiMan.hpp" … … 359 363 void ClientStateInGameT::Render(float FrameTime) 360 364 { 365 const wxSize FrameSize=wxGetApp().GetMainFrame()->GetClientSize(); 366 361 367 Graphs.ClearForFrame(ClientFrameNr); 362 368 … … 383 389 static ConVarT ShowPosition("showPos", false, ConVarT::FLAG_MAIN_EXE, "Toggles whether the current players position is shown."); 384 390 385 if (ShowFrameRate.GetValueBool()) Font_f.Print( SingleOpenGLWindow->GetWidth()-100, SingleOpenGLWindow->GetHeight()-16, 0x00FFFFFF, "FPS %5.1f", 1.0f/FrameTime);391 if (ShowFrameRate.GetValueBool()) Font_f.Print(FrameSize.GetWidth()-100, FrameSize.GetHeight()-16, FrameSize.GetWidth(), FrameSize.GetHeight(), 0x00FFFFFF, "FPS %5.1f", 1.0f/FrameTime); 386 392 387 393 if (ShowPosition.GetValueBool()) … … 393 399 // LeafContents=World->GetCa3DEWorldP()->Map.Leaves[LeafNr].IsWaterLeaf ? 'w' : 'i'; 394 400 395 Font_f.Print( SingleOpenGLWindow->GetWidth()-130, 15, 0x00FFFFFF, "X %10.1f", OurEntityCurrentState->Origin.x);396 Font_f.Print( SingleOpenGLWindow->GetWidth()-130, 35, 0x00FFFFFF, "Y %10.1f", OurEntityCurrentState->Origin.y);397 Font_f.Print( SingleOpenGLWindow->GetWidth()-130, 55, 0x00FFFFFF, "Z %10.1f", OurEntityCurrentState->Origin.z);398 Font_f.Print( SingleOpenGLWindow->GetWidth()-130, 75, 0x00FFFFFF, "Hdg %8u", OurEntityCurrentState->Heading);399 // Font_f.Print( SingleOpenGLWindow->GetWidth()-100, SingleOpenGLWindow->GetHeight()-32, 0x00FFFFFF, "L %4u %c", LeafNr, LeafContents);401 Font_f.Print(FrameSize.GetWidth()-130, 15, FrameSize.GetWidth(), FrameSize.GetHeight(), 0x00FFFFFF, "X %10.1f", OurEntityCurrentState->Origin.x); 402 Font_f.Print(FrameSize.GetWidth()-130, 35, FrameSize.GetWidth(), FrameSize.GetHeight(), 0x00FFFFFF, "Y %10.1f", OurEntityCurrentState->Origin.y); 403 Font_f.Print(FrameSize.GetWidth()-130, 55, FrameSize.GetWidth(), FrameSize.GetHeight(), 0x00FFFFFF, "Z %10.1f", OurEntityCurrentState->Origin.z); 404 Font_f.Print(FrameSize.GetWidth()-130, 75, FrameSize.GetWidth(), FrameSize.GetHeight(), 0x00FFFFFF, "Hdg %8u", OurEntityCurrentState->Heading); 405 // Font_f.Print(FrameSize.GetWidth()-100, FrameSize.GetHeight()-32, FrameSize.GetWidth(), FrameSize.GetHeight(), 0x00FFFFFF, "L %4u %c", LeafNr, LeafContents); 400 406 } 401 407 … … 412 418 else 413 419 { 414 Font_f.Print(30, SingleOpenGLWindow->GetHeight()*2/3, 0x00004080, "Receiving entity baselines...");420 Font_f.Print(30, FrameSize.GetHeight()*2/3, FrameSize.GetWidth(), FrameSize.GetHeight(), 0x00004080, "Receiving entity baselines..."); 415 421 } 416 422 } … … 426 432 MatSys::Renderer->SetMatrix(MatSys::RendererI::MODEL_TO_WORLD, MatrixT()); 427 433 MatSys::Renderer->SetMatrix(MatSys::RendererI::WORLD_TO_VIEW, MatrixT()); 428 MatSys::Renderer->SetMatrix(MatSys::RendererI::PROJECTION, MatrixT::GetProjOrthoMatrix(0.0f, float( SingleOpenGLWindow->GetWidth()), float(SingleOpenGLWindow->GetHeight()), 0.0f, -1.0f, 1.0f));434 MatSys::Renderer->SetMatrix(MatSys::RendererI::PROJECTION, MatrixT::GetProjOrthoMatrix(0.0f, float(FrameSize.GetWidth()), float(FrameSize.GetHeight()), 0.0f, -1.0f, 1.0f)); 429 435 430 436 MatSys::Renderer->SetCurrentRenderAction(MatSys::RendererI::AMBIENT); … … 442 448 // The coordinates have also been tested with a hor. and ver. stripe pattern texture for making sure that there is no 443 449 // inadvertent scaling by plus or minus one pixel. 444 M.Vertices[0].SetOrigin( SingleOpenGLWindow->GetWidth()/2.0f-512.0f, SingleOpenGLWindow->GetHeight()/2.0f-256.0f-20.0f); // links oben445 M.Vertices[1].SetOrigin( SingleOpenGLWindow->GetWidth()/2.0f+512.0f, SingleOpenGLWindow->GetHeight()/2.0f-256.0f-20.0f); // rechts oben446 M.Vertices[2].SetOrigin( SingleOpenGLWindow->GetWidth()/2.0f+512.0f, SingleOpenGLWindow->GetHeight()/2.0f+256.0f-20.0f); // rechts unten447 M.Vertices[3].SetOrigin( SingleOpenGLWindow->GetWidth()/2.0f-512.0f, SingleOpenGLWindow->GetHeight()/2.0f+256.0f-20.0f); // links unten450 M.Vertices[0].SetOrigin(FrameSize.GetWidth()/2.0f-512.0f, FrameSize.GetHeight()/2.0f-256.0f-20.0f); // links oben 451 M.Vertices[1].SetOrigin(FrameSize.GetWidth()/2.0f+512.0f, FrameSize.GetHeight()/2.0f-256.0f-20.0f); // rechts oben 452 M.Vertices[2].SetOrigin(FrameSize.GetWidth()/2.0f+512.0f, FrameSize.GetHeight()/2.0f+256.0f-20.0f); // rechts unten 453 M.Vertices[3].SetOrigin(FrameSize.GetWidth()/2.0f-512.0f, FrameSize.GetHeight()/2.0f+256.0f-20.0f); // links unten 448 454 449 455 MatSys::Renderer->SetCurrentMaterial(LogoRenderMat); … … 453 459 454 460 #if 0 455 const unsigned long BarHalfWidth= SingleOpenGLWindow->GetWidth()/2-40;461 const unsigned long BarHalfWidth=FrameSize.GetWidth()/2-40; 456 462 457 463 // Render the left end of the loading bar. 458 464 { 459 M.Vertices[0].SetOrigin( SingleOpenGLWindow->GetWidth()/2-BarHalfWidth-16, SingleOpenGLWindow->GetHeight()*9/10-20 );460 M.Vertices[1].SetOrigin( SingleOpenGLWindow->GetWidth()/2-BarHalfWidth , SingleOpenGLWindow->GetHeight()*9/10-20 );461 M.Vertices[2].SetOrigin( SingleOpenGLWindow->GetWidth()/2-BarHalfWidth , SingleOpenGLWindow->GetHeight()*9/10-20+32);462 M.Vertices[3].SetOrigin( SingleOpenGLWindow->GetWidth()/2-BarHalfWidth-16, SingleOpenGLWindow->GetHeight()*9/10-20+32);465 M.Vertices[0].SetOrigin(FrameSize.GetWidth()/2-BarHalfWidth-16, FrameSize.GetHeight()*9/10-20 ); 466 M.Vertices[1].SetOrigin(FrameSize.GetWidth()/2-BarHalfWidth , FrameSize.GetHeight()*9/10-20 ); 467 M.Vertices[2].SetOrigin(FrameSize.GetWidth()/2-BarHalfWidth , FrameSize.GetHeight()*9/10-20+32); 468 M.Vertices[3].SetOrigin(FrameSize.GetWidth()/2-BarHalfWidth-16, FrameSize.GetHeight()*9/10-20+32); 463 469 464 470 MatSys::Renderer->SetCurrentMaterial(LoadingBarLMat); … … 468 474 // Render the center left (filled) part of the loading bar. 469 475 { 470 M.Vertices[0].SetOrigin( SingleOpenGLWindow->GetWidth()/2-BarHalfWidth , SingleOpenGLWindow->GetHeight()*9/10-20 );471 M.Vertices[1].SetOrigin( SingleOpenGLWindow->GetWidth()/2-BarHalfWidth+2*BarHalfWidth*ProgressPercent, SingleOpenGLWindow->GetHeight()*9/10-20 );472 M.Vertices[2].SetOrigin( SingleOpenGLWindow->GetWidth()/2-BarHalfWidth+2*BarHalfWidth*ProgressPercent, SingleOpenGLWindow->GetHeight()*9/10-20+32);473 M.Vertices[3].SetOrigin( SingleOpenGLWindow->GetWidth()/2-BarHalfWidth , SingleOpenGLWindow->GetHeight()*9/10-20+32);476 M.Vertices[0].SetOrigin(FrameSize.GetWidth()/2-BarHalfWidth , FrameSize.GetHeight()*9/10-20 ); 477 M.Vertices[1].SetOrigin(FrameSize.GetWidth()/2-BarHalfWidth+2*BarHalfWidth*ProgressPercent, FrameSize.GetHeight()*9/10-20 ); 478 M.Vertices[2].SetOrigin(FrameSize.GetWidth()/2-BarHalfWidth+2*BarHalfWidth*ProgressPercent, FrameSize.GetHeight()*9/10-20+32); 479 M.Vertices[3].SetOrigin(FrameSize.GetWidth()/2-BarHalfWidth , FrameSize.GetHeight()*9/10-20+32); 474 480 475 481 MatSys::Renderer->SetCurrentMaterial(LoadingBar1Mat); … … 479 485 // Render the center right (not yet filled) part of the loading bar. 480 486 { 481 M.Vertices[0].SetOrigin( SingleOpenGLWindow->GetWidth()/2-BarHalfWidth+2*BarHalfWidth*ProgressPercent, SingleOpenGLWindow->GetHeight()*9/10-20 );482 M.Vertices[1].SetOrigin( SingleOpenGLWindow->GetWidth()/2+BarHalfWidth , SingleOpenGLWindow->GetHeight()*9/10-20 );483 M.Vertices[2].SetOrigin( SingleOpenGLWindow->GetWidth()/2+BarHalfWidth , SingleOpenGLWindow->GetHeight()*9/10-20+32);484 M.Vertices[3].SetOrigin( SingleOpenGLWindow->GetWidth()/2-BarHalfWidth+2*BarHalfWidth*ProgressPercent, SingleOpenGLWindow->GetHeight()*9/10-20+32);487 M.Vertices[0].SetOrigin(FrameSize.GetWidth()/2-BarHalfWidth+2*BarHalfWidth*ProgressPercent, FrameSize.GetHeight()*9/10-20 ); 488 M.Vertices[1].SetOrigin(FrameSize.GetWidth()/2+BarHalfWidth , FrameSize.GetHeight()*9/10-20 ); 489 M.Vertices[2].SetOrigin(FrameSize.GetWidth()/2+BarHalfWidth , FrameSize.GetHeight()*9/10-20+32); 490 M.Vertices[3].SetOrigin(FrameSize.GetWidth()/2-BarHalfWidth+2*BarHalfWidth*ProgressPercent, FrameSize.GetHeight()*9/10-20+32); 485 491 486 492 MatSys::Renderer->SetCurrentMaterial(LoadingBar0Mat); … … 490 496 // Render the right end of the loading bar. 491 497 { 492 M.Vertices[0].SetOrigin( SingleOpenGLWindow->GetWidth()/2+BarHalfWidth , SingleOpenGLWindow->GetHeight()*9/10-20 );493 M.Vertices[1].SetOrigin( SingleOpenGLWindow->GetWidth()/2+BarHalfWidth+16, SingleOpenGLWindow->GetHeight()*9/10-20 );494 M.Vertices[2].SetOrigin( SingleOpenGLWindow->GetWidth()/2+BarHalfWidth+16, SingleOpenGLWindow->GetHeight()*9/10-20+32);495 M.Vertices[3].SetOrigin( SingleOpenGLWindow->GetWidth()/2+BarHalfWidth , SingleOpenGLWindow->GetHeight()*9/10-20+32);498 M.Vertices[0].SetOrigin(FrameSize.GetWidth()/2+BarHalfWidth , FrameSize.GetHeight()*9/10-20 ); 499 M.Vertices[1].SetOrigin(FrameSize.GetWidth()/2+BarHalfWidth+16, FrameSize.GetHeight()*9/10-20 ); 500 M.Vertices[2].SetOrigin(FrameSize.GetWidth()/2+BarHalfWidth+16, FrameSize.GetHeight()*9/10-20+32); 501 M.Vertices[3].SetOrigin(FrameSize.GetWidth()/2+BarHalfWidth , FrameSize.GetHeight()*9/10-20+32); 496 502 497 503 MatSys::Renderer->SetCurrentMaterial(LoadingBarRMat); … … 507 513 508 514 #ifdef DEBUG 509 LoadingFont->Print( SingleOpenGLWindow->GetWidth()/2-34*CharWidth/2, SingleOpenGLWindow->GetHeight()*9/10+12, 0x00800000, "Version: %s [Debug build], %s", __DATE__, LoadingProgressText.c_str());515 LoadingFont->Print(FrameSize.GetWidth()/2-34*CharWidth/2, FrameSize.GetHeight()*9/10+12, FrameSize.GetWidth(), FrameSize.GetHeight(), 0x00800000, "Version: %s [Debug build], %s", __DATE__, LoadingProgressText.c_str()); 510 516 #else 511 LoadingFont->Print( SingleOpenGLWindow->GetWidth()/2-20*CharWidth/2, SingleOpenGLWindow->GetHeight()*9/10+12, 0x00800000, "Version: %s", __DATE__);517 LoadingFont->Print(FrameSize.GetWidth()/2-20*CharWidth/2, FrameSize.GetHeight()*9/10+12, FrameSize.GetWidth(), FrameSize.GetHeight(), 0x00800000, "Version: %s", __DATE__); 512 518 #endif 513 519 514 520 if (LoadingProgressPercent>0) 515 LoadingFont->Print( SingleOpenGLWindow->GetWidth()/2-10*CharWidth/2, SingleOpenGLWindow->GetHeight()*9/10+30, 0x00800000, "Loading... %.0f%%", LoadingProgressPercent*100.0f);521 LoadingFont->Print(FrameSize.GetWidth()/2-10*CharWidth/2, FrameSize.GetHeight()*9/10+30, FrameSize.GetWidth(), FrameSize.GetHeight(), 0x00800000, "Loading... %.0f%%", LoadingProgressPercent*100.0f); 516 522 else 517 LoadingFont->Print( SingleOpenGLWindow->GetWidth()/2-10*CharWidth/2, SingleOpenGLWindow->GetHeight()*9/10+30, 0x00800000, "Loading...");523 LoadingFont->Print(FrameSize.GetWidth()/2-10*CharWidth/2, FrameSize.GetHeight()*9/10+30, FrameSize.GetWidth(), FrameSize.GetHeight(), 0x00800000, "Loading..."); 518 524 } 519 525 else … … 521 527 // We have no world yet, and are currently not loading one, 522 528 // which means that we're still waiting for a SC1_WorldInfo message. 523 Font_f.Print(5, 200, 0x00DDFFBB, "Waiting for SC1_WorldInfo message...");529 Font_f.Print(5, 200, FrameSize.GetWidth(), FrameSize.GetHeight(), 0x00DDFFBB, "Waiting for SC1_WorldInfo message..."); 524 530 } 525 531 } … … 536 542 } 537 543 538 ChatScrollInfo .Draw(Font_v, 5, SingleOpenGLWindow->GetHeight()-10-140);544 ChatScrollInfo .Draw(Font_v, 5, FrameSize.GetHeight()-10-140, FrameSize.GetWidth(), FrameSize.GetHeight()); 539 545 ChatScrollInfo .AdvanceTime(FrameTime); 540 SystemScrollInfo.Draw(Font_v, 5, 15 );546 SystemScrollInfo.Draw(Font_v, 5, 15, FrameSize.GetWidth(), FrameSize.GetHeight()); 541 547 SystemScrollInfo.AdvanceTime(FrameTime); 542 548 … … 589 595 590 596 MatSys::Renderer->EndFrame(); 591 SingleOpenGLWindow->SwapBuffers();597 wxGetApp().GetMainFrame()->GetMainCanvas()->SwapBuffers(); 592 598 593 599 SoundSystem->Update(); … … 809 815 810 816 // This is unfortunately needed, because the users last click (in the GUI) that brought us here may still have the "LMB up" event pending. 817 #if 0 811 818 WasLMBOnceUp|=(SingleOpenGLWindow->GetMouseButtonState() & 0x1)==0; 812 819 … … 843 850 if (SingleOpenGLWindow->GetKeyboardState()[CaKeyboardEventT::CK_END ]) PlayerCommand.Keys|=PCK_CenterView; 844 851 } 852 #endif 845 853 846 854 -
cafu/branches/cafu_to_wx/Ca3DE/Client/Graphs.cpp
r36 r116 26 26 /****************************/ 27 27 28 #include "../AppCafu.hpp" 29 #include "../MainFrame.hpp" 28 30 #include "Graphs.hpp" 29 31 #include "MaterialSystem/MaterialManager.hpp" … … 31 33 #include "MaterialSystem/Renderer.hpp" 32 34 #include "Math3D/Matrix.hpp" 33 #include "OpenGL/OpenGLWindow.hpp" // OpenGL Window34 35 35 36 … … 81 82 void GraphsT::Draw(unsigned long ClientFrameNr) 82 83 { 84 const wxSize FrameSize=wxGetApp().GetMainFrame()->GetClientSize(); 83 85 unsigned long FrameNr=512; 84 86 … … 89 91 MatSys::Renderer->SetMatrix(MatSys::RendererI::MODEL_TO_WORLD, MatrixT()); 90 92 MatSys::Renderer->SetMatrix(MatSys::RendererI::WORLD_TO_VIEW, MatrixT()); 91 MatSys::Renderer->SetMatrix(MatSys::RendererI::PROJECTION, MatrixT::GetProjOrthoMatrix(0.0f, float( SingleOpenGLWindow->GetWidth()), float(SingleOpenGLWindow->GetHeight()), 0.0f, -1.0f, 1.0f));93 MatSys::Renderer->SetMatrix(MatSys::RendererI::PROJECTION, MatrixT::GetProjOrthoMatrix(0.0f, float(FrameSize.GetWidth()), float(FrameSize.GetHeight()), 0.0f, -1.0f, 1.0f)); 92 94 93 95 static MatSys::MeshT LinesMesh (MatSys::MeshT::Lines ); LinesMesh .Vertices.Overwrite(); … … 100 102 LinesMesh.Vertices.PushBackEmpty(); 101 103 LinesMesh.Vertices[LinesMesh.Vertices.Size()-1].SetColor(0.5, 0.5, 0.5); 102 LinesMesh.Vertices[LinesMesh.Vertices.Size()-1].SetOrigin(( SingleOpenGLWindow->GetWidth()-512)/2+FrameNr, SingleOpenGLWindow->GetHeight()-10);104 LinesMesh.Vertices[LinesMesh.Vertices.Size()-1].SetOrigin((FrameSize.GetWidth()-512)/2+FrameNr, FrameSize.GetHeight()-10); 103 105 104 106 LinesMesh.Vertices.PushBackEmpty(); 105 107 LinesMesh.Vertices[LinesMesh.Vertices.Size()-1].SetColor(0.5, 0.5, 0.5); 106 LinesMesh.Vertices[LinesMesh.Vertices.Size()-1].SetOrigin(( SingleOpenGLWindow->GetWidth()-512)/2+FrameNr, SingleOpenGLWindow->GetHeight()-10-FPS[FrameIndex]);108 LinesMesh.Vertices[LinesMesh.Vertices.Size()-1].SetOrigin((FrameSize.GetWidth()-512)/2+FrameNr, FrameSize.GetHeight()-10-FPS[FrameIndex]); 107 109 108 110 109 111 PointsMesh.Vertices.PushBackEmpty(); 110 112 PointsMesh.Vertices[PointsMesh.Vertices.Size()-1].SetColor(1.0, 0.0, 1.0); 111 PointsMesh.Vertices[PointsMesh.Vertices.Size()-1].SetOrigin(( SingleOpenGLWindow->GetWidth()-512)/2+FrameNr, SingleOpenGLWindow->GetHeight()-10-Heading[FrameIndex]);113 PointsMesh.Vertices[PointsMesh.Vertices.Size()-1].SetOrigin((FrameSize.GetWidth()-512)/2+FrameNr, FrameSize.GetHeight()-10-Heading[FrameIndex]); 112 114 113 115 PointsMesh.Vertices.PushBackEmpty(); 114 116 PointsMesh.Vertices[PointsMesh.Vertices.Size()-1].SetColor(0.0, 1.0, 0.0); 115 PointsMesh.Vertices[PointsMesh.Vertices.Size()-1].SetOrigin(( SingleOpenGLWindow->GetWidth()-512)/2+FrameNr, SingleOpenGLWindow->GetHeight()-10-PosY[FrameIndex]);117 PointsMesh.Vertices[PointsMesh.Vertices.Size()-1].SetOrigin((FrameSize.GetWidth()-512)/2+FrameNr, FrameSize.GetHeight()-10-PosY[FrameIndex]); 116 118 117 119 PointsMesh.Vertices.PushBackEmpty(); 118 120 PointsMesh.Vertices[PointsMesh.Vertices.Size()-1].SetColor(0.0, 0.0, 1.0); 119 PointsMesh.Vertices[PointsMesh.Vertices.Size()-1].SetOrigin(( SingleOpenGLWindow->GetWidth()-512)/2+FrameNr, SingleOpenGLWindow->GetHeight()-10-PosZ[FrameIndex]);121 PointsMesh.Vertices[PointsMesh.Vertices.Size()-1].SetOrigin((FrameSize.GetWidth()-512)/2+FrameNr, FrameSize.GetHeight()-10-PosZ[FrameIndex]); 120 122 121 123 ClientFrameNr--; -
cafu/branches/cafu_to_wx/CompilerSetup.py.tmpl
r104 r116 27 27 # # Print all valid values for MSVC_VERSION on your system. 28 28 # envCommon=Environment(MSVC_VERSION="XXX"); 29 # 29 # 30 30 # # Use Visual C/C++ version 9 (2008), Express Edition. 31 31 # envCommon=Environment(MSVC_VERSION="9.0Exp"); 32 # 32 # 33 33 # # Use the latest Visual C/C++ version for creating 32 bit binaries. 34 34 # envCommon=Environment(TARGET_ARCH="x86"); 35 # 35 # 36 36 # # Use Visual C/C++ version 9 (2008) for creating 32 bit binaries. 37 37 # envCommon=Environment(MSVC_VERSION="9.0", TARGET_ARCH="x86"); … … 50 50 # Example: scons -Q bv=dpr 51 51 buildVariants="dr"; 52 53 54 # These settings specify where the wxWidgets toolkit is found under Windows and55 # Linux. If you followed the instructions in the Cafu documentation at56 # http://www.cafu.de/wiki/, the given default value should be OK for both57 # wxMSW (Windows) and wxGTK (Linux), so there is no need to change it.58 wxMSW_Path="#/ExtLibs/wxWidgets"; # The given value should be OK.59 wxGTK_Path="#/ExtLibs/wxWidgets"; # The given value should be OK. -
cafu/branches/cafu_to_wx/SConscript
r107 r116 49 49 # glu32 is only needed for the TerrainViewerOld... 50 50 envTools.Append(LIBS=Split("SceneGraph MatSys cfsCoreLib cfsLib ClipSys cfs_png cfs_jpeg bulletcollision lua minizip lightwave z") 51 + Split("gdi32 glu32 opengl32 user32") + [' dinput', 'dxguid'])51 + Split("gdi32 glu32 opengl32 user32") + ['cfsOpenGL', 'dinput', 'dxguid']) 52 52 elif sys.platform=="linux2": 53 53 # envTools.Append(LINKFLAGS = ['-Wl,--export-dynamic']) # Not needed any more, .so libs now link to the required .a libs directly, just as under Windows. 54 54 # GLU is needed for the TerrainViewerOld *and* for e.g. gluBuild2DMipmaps() in the renderers... 55 55 envTools.Append(CPPPATH=['/usr/include/freetype2']) # As of 2009-09-10, this line is to become unnecessary in the future, see /usr/include/ftbuild.h for details. 56 envTools.Append(LIBS=Split("SceneGraph MatSys cfs Lib cfsCoreLib cfsLib ClipSys cfs_png cfs_jpeg bulletcollision lua minizip lightwave z")56 envTools.Append(LIBS=Split("SceneGraph MatSys cfsOpenGL cfsLib cfsCoreLib cfsLib ClipSys cfs_png cfs_jpeg bulletcollision lua minizip lightwave z") 57 57 + Split("GL GLU")) 58 58 … … 76 76 77 77 78 envCafu = env.Clone() 79 envCafu.Append(CPPPATH=['ExtLibs/lua/src']) 80 81 CafuMainObj = envCafu.StaticObject("Ca3DE/Ca3DE", "Ca3DE/Cafu.cpp") 82 CafuMainDediObj = envCafu.StaticObject("Ca3DE/Ca3DE-dedi", "Ca3DE/Cafu.cpp", CPPDEFINES=env['CPPDEFINES']+['CAFU_DEDICATED_SERVER']) 83 84 EngineCommonAndServerObjs = envCafu.StaticObject(Split(""" 85 Ca3DE/Both/Ca3DEWorld.cpp Ca3DE/Both/EntityManager.cpp Ca3DE/Both/EngineEntity.cpp 86 Ca3DE/Server/Server.cpp Ca3DE/Server/ServerWorld.cpp Ca3DE/Server/ClientInfo.cpp""")) 78 # Create a common construction environment for our wxWidgets-based programs (Cafu and CaWE). 79 wxEnv = env.Clone() 87 80 88 81 if sys.platform=="win32": 89 envCafu.Append(LIBPATH=['ExtLibs/DirectX7/lib']) 90 envCafu.Append(LIBS=Split("SceneGraph MatSys SoundSys cfsLib cfsCoreLib cfs_png cfs_jpeg bulletcollision minizip z lua ClipSys GuiSysNullEditor")) 91 envCafu.Append(LIBS=Split("lightwave")) # For the GuiSys::ModelWindowT class. 92 envCafu.Append(LIBS=Split("gdi32 opengl32 user32 wsock32") + ['dinput', 'dxguid']) 93 WinResource=envCafu.RES("Ca3DE/Dialog1.rc") + envCafu.RES("Ca3DE/Cafu.rc", CPPPATH=[CompilerSetup.wxMSW_Path+'/include']) 94 95 elif sys.platform=="linux2": 96 WinResource=[] 97 # -Wl,-rpath,. is so that also the . directory is searched for dynamic libraries when they're opened. 98 # -Wl,--export-dynamic is so that the exe exports its symbols so that the MatSys, SoundSys and game .so libs can in turn resolve theirs. 99 envCafu.Append(LINKFLAGS = ['-Wl,-rpath,.', '-Wl,--export-dynamic']) 100 envCafu.Append(LIBS=Split("MatSys SoundSys SceneGraph cfsLib cfsCoreLib cfs_png cfs_jpeg bulletdynamics bulletcollision bulletmath openal alut mpg123 ogg vorbis vorbisfile minizip z lua lightwave ClipSys GuiSysNullEditor")) 101 # We need GLU for e.g. gluBuild2DMipmaps() in the renderers. 102 # pthread is needed because some libraries that we load (possibly indirectly), e.g. the libCg.so and libopenal.so, use functions 103 # from the pthread library, but have not been linked themselves against it. They rely on the executable to be linked appropriately 104 # in order to resolve the pthread symbols. Paul Pluzhnikov states in a newsgroup posting (see [1]) that even if the .so libs were 105 # linked against libpthread.so, the main exe still *must* link with -lpthread, too, because: 106 # "Note that dlopen()ing an MT library from non-MT executable is not supported on most platforms, certainly not on Linux." 107 # [1] http://groups.google.de/group/gnu.gcc.help/browse_thread/thread/1e8f8dfd6027d7fa/ 108 # rt is required in order to resolve clock_gettime() in openal-soft. 109 envCafu.Append(LIBS=Split("GL GLU rt pthread")) 110 # Wrapping -lcfsLib in --whole-archive and --no-whole-archive is required so that the linker puts all symbols that are in libcfsLib.a 111 # into the executable, because otherwise, it would omit e.g. some ParticleEngine-related stuff that is not referenced by the engine, 112 # and when the game DLL later needs it, we get an "undefined symbol" error from dlopen(). 113 # See my post "Having the GNU linker *not* remove unused symbols..." to the gnu.g++.help newsgroup on 2006-04-07, 114 # and the replies by Maett and Paul Pluzhnikov. 115 # Implementing this by appending to LINKCOM and using --allow-multiple-definition is a SCons-specific hack though, 116 # because SCons currently does not support such kind of "wrapping". See my post to the scons-users mailing list on 2006-04-09 117 # at http://scons.tigris.org/servlets/BrowseList?list=users&by=thread&from=455553. 118 # The "-llightwave, ..." are all needed as a direct consequence of the forced --whole-archive for cfsLib, 119 # which in turn requires these... 120 # Note that this (using --whole-archive) is actually the proper strategy under Linux (vs. Windows), because this is *the* way 121 # in order to make sure that the -fPIC can be handled correctly - otherwise we had to link .so libs with non-fPIC object files... 122 envCafu.Append(LINKCOM=" -Wl,--allow-multiple-definition -Wl,--whole-archive -lcfsLib -lbulletdynamics -lbulletcollision -lbulletmath -lopenal -lalut -lmpg123 -logg -lvorbis -lvorbisfile -Wl,--no-whole-archive -llightwave -lz") 123 124 envCafu.Program('Ca3DE/Cafu', 125 CafuMainObj + EngineCommonAndServerObjs + CommonWorldObject + ["Common/WorldMan.cpp"] + WinResource + 126 Glob("Ca3DE/Client/*.cpp")) 127 128 # Build an explicit dedicated server currently only under Linux. 129 # Build it with env.Program() instead of envCafu.Program()? I used env before, and lazily fixed link problems by switching to envCafu... 130 if sys.platform=="linux2": 131 envCafu.Program('Ca3DE/Cafu-dedicated', CafuMainDediObj + EngineCommonAndServerObjs + CommonWorldObject + ["Common/WorldMan.cpp"]) 132 133 134 135 SourceFilesList=(Glob("CaWE/*.cpp") 136 +Glob("CaWE/FontWizard/*.cpp") 137 +Glob("CaWE/GuiEditor/*.cpp")+Glob("CaWE/GuiEditor/Commands/*.cpp")+Glob("CaWE/GuiEditor/EditorData/*.cpp") 138 +Glob("CaWE/MapCommands/*.cpp") 139 +Glob("CaWE/MaterialBrowser/*.cpp") 140 +Glob("CaWE/ModelEditor/*.cpp") 141 +Glob("CaWE/wxExt/*.cpp") 142 +Glob("CaWE/wxFB/*.cpp")) 143 144 wxEnv = env.Clone() 145 wxEnv.Append(CPPPATH=['ExtLibs/lua/src', 146 'ExtLibs/noise/src']) 147 148 if sys.platform=="win32": 149 wxPath=CompilerSetup.wxMSW_Path; 82 wxPath="#/ExtLibs/wxWidgets"; 150 83 151 84 wxEnv.Append(CPPPATH = [wxPath+'/include']) … … 163 96 LibPath += "_lib" 164 97 165 wxEnv.Append(CPPPATH=['ExtLibs/freetype/include']) # Linux builds (must) use the systems freetype library instead.166 98 wxEnv.Append(LIBPATH = [wxPath+LibPath]) 167 wxEnv.Append(LIBS = Split("SceneGraph MatSys cfsLib cfsCoreLib ClipSys cfs_png cfs_jpeg bulletcollision noise lua minizip lightwave z"))168 wxEnv.Append(LIBS = Split("freetype"))169 wxEnv.Append(LIBS = Split("advapi32 comctl32 comdlg32 gdi32 ole32 oleaut32 opengl32 rpcrt4 shell32 user32 winspool wsock32"))170 99 171 100 if buildMode=="dbg": … … 176 105 wxEnv.Append(LIBS = Split("wxbase29u wxbase29u_net wxjpeg wxmsw29u_adv wxmsw29u_core wxmsw29u_gl wxmsw29u_aui wxmsw29u_propgrid wxregexu")) 177 106 178 WinResource=wxEnv.RES("CaWE/CaWE.rc") 107 elif sys.platform=="linux2": 108 # Geht es auch ohne die naechste Zeile? Woher weiss es, dass es freetype linken soll??? 109 wxEnv.Append(LIBS = Split("wx_gtk2u_gl-2.9 wx_gtk2u_aui-2.9 wx_gtk2u_propgrid-2.9 wx_gtk2u_xrc-2.9 wx_gtk2u_qa-2.9 wx_gtk2u_html-2.9 wx_gtk2u_adv-2.9 wx_gtk2u_core-2.9 wx_baseu_xml-2.9 wx_baseu_net-2.9 wx_baseu-2.9")) 110 wxEnv.ParseConfig(Dir("#/ExtLibs/wxWidgets").abspath + "/build-gtk/wx-config --cxxflags --libs std,gl") 111 112 113 114 envCafu = wxEnv.Clone() 115 envCafu.Append(CPPPATH=['ExtLibs/lua/src']) 116 117 if sys.platform=="win32": 118 envCafu.Append(LIBS=Split("SceneGraph MatSys SoundSys cfsLib cfsCoreLib cfs_png cfs_jpeg bulletcollision minizip z lua ClipSys GuiSysNullEditor")) 119 envCafu.Append(LIBS=Split("lightwave")) # For the GuiSys::ModelWindowT class. 120 envCafu.Append(LIBS=Split("advapi32 comctl32 comdlg32 gdi32 ole32 oleaut32 opengl32 rpcrt4 shell32 user32 winspool wsock32")) 121 122 WinResource=envCafu.RES("Ca3DE/Cafu.rc") # + envCafu.RES("Ca3DE/Dialog1.rc") 179 123 180 124 elif sys.platform=="linux2": 181 wxPath=Dir(CompilerSetup.wxGTK_Path).abspath; 125 # -Wl,-rpath,. is so that also the . directory is searched for dynamic libraries when they're opened. 126 # -Wl,--export-dynamic is so that the exe exports its symbols so that the MatSys, SoundSys and game .so libs can in turn resolve theirs. 127 envCafu.Append(LINKFLAGS = ['-Wl,-rpath,.', '-Wl,--export-dynamic']) 128 envCafu.Append(LIBS=Split("MatSys SoundSys SceneGraph cfsLib cfsCoreLib cfs_png cfs_jpeg bulletdynamics bulletcollision bulletmath openal alut mpg123 ogg vorbis vorbisfile minizip z lua lightwave ClipSys GuiSysNullEditor")) 182 129 183 wxEnv.Append(CPPPATH=['/usr/include/freetype2']) # As of 2009-09-10, this line is to become unnecessary in the future, see /usr/include/ftbuild.h for details. 184 wxEnv.Append(LINKFLAGS = ['-Wl,--export-dynamic']) # Need this so that the Renderer DLLs can have their unresolved symbols dynamically resolved at load time. 185 wxEnv.Append(LIBS = Split("SceneGraph MatSys cfsCoreLib cfsLib ClipSys cfs_png cfs_jpeg bulletcollision noise lua minizip lightwave z")) 130 # We need GLU for e.g. gluBuild2DMipmaps() in the renderers. 131 # pthread is needed because some libraries that we load (possibly indirectly), e.g. the libCg.so and libopenal.so, use functions 132 # from the pthread library, but have not been linked themselves against it. They rely on the executable to be linked appropriately 133 # in order to resolve the pthread symbols. Paul Pluzhnikov states in a newsgroup posting (see [1]) that even if the .so libs were 134 # linked against libpthread.so, the main exe still *must* link with -lpthread, too, because: 135 # "Note that dlopen()ing an MT library from non-MT executable is not supported on most platforms, certainly not on Linux." 136 # [1] http://groups.google.de/group/gnu.gcc.help/browse_thread/thread/1e8f8dfd6027d7fa/ 137 # rt is required in order to resolve clock_gettime() in openal-soft. 138 envCafu.Append(LIBS=Split("GL GLU rt pthread")) 186 139 187 wxEnv.Append(LIBS = Split("wx_gtk2u_gl-2.9 wx_gtk2u_aui-2.9 wx_gtk2u_propgrid-2.9 wx_gtk2u_xrc-2.9 wx_gtk2u_qa-2.9 wx_gtk2u_html-2.9 wx_gtk2u_adv-2.9 wx_gtk2u_core-2.9 wx_baseu_xml-2.9 wx_baseu_net-2.9 wx_baseu-2.9")) 188 wxEnv.ParseConfig(wxPath + "/build-gtk/wx-config --cxxflags --libs std,gl") 140 # Wrapping -lcfsLib in --whole-archive and --no-whole-archive is required so that the linker puts all symbols that are in libcfsLib.a 141 # into the executable, because otherwise, it would omit e.g. some ParticleEngine-related stuff that is not referenced by the engine, 142 # and when the game DLL later needs it, we get an "undefined symbol" error from dlopen(). 143 # See my post "Having the GNU linker *not* remove unused symbols..." to the gnu.g++.help newsgroup on 2006-04-07, 144 # and the replies by Maett and Paul Pluzhnikov. 145 # Implementing this by appending to LINKCOM and using --allow-multiple-definition is a SCons-specific hack though, 146 # because SCons currently does not support such kind of "wrapping". See my post to the scons-users mailing list on 2006-04-09 147 # at http://scons.tigris.org/servlets/BrowseList?list=users&by=thread&from=455553. 148 # The "-llightwave, ..." are all needed as a direct consequence of the forced --whole-archive for cfsLib, 149 # which in turn requires these... 150 # Note that this (using --whole-archive) is actually the proper strategy under Linux (vs. Windows), because this is *the* way 151 # in order to make sure that the -fPIC can be handled correctly - otherwise we had to link .so libs with non-fPIC object files... 152 envCafu.Append(LINKCOM=" -Wl,--allow-multiple-definition -Wl,--whole-archive -lcfsLib -lbulletdynamics -lbulletcollision -lbulletmath -lopenal -lalut -lmpg123 -logg -lvorbis -lvorbisfile -Wl,--no-whole-archive -llightwave -lz") 189 153 190 154 WinResource=[] 191 155 192 wxEnv.Program('CaWE/CaWE', SourceFilesList + WinResource + CommonWorldObject) 156 EngineCommonAndServerObjs = envCafu.StaticObject(Split("""Ca3DE/AppCafu.cpp Ca3DE/MainCanvas.cpp Ca3DE/MainFrame.cpp Ca3DE/ConDefs.cpp 157 Ca3DE/Both/Ca3DEWorld.cpp Ca3DE/Both/EntityManager.cpp Ca3DE/Both/EngineEntity.cpp 158 Ca3DE/Server/Server.cpp Ca3DE/Server/ServerWorld.cpp Ca3DE/Server/ClientInfo.cpp""")) 159 160 envCafu.Program('Ca3DE/Cafu', 161 EngineCommonAndServerObjs + CommonWorldObject + ["Common/WorldMan.cpp"] + WinResource + 162 Glob("Ca3DE/Client/*.cpp")) 163 164 165 166 envCaWE = wxEnv.Clone() 167 envCaWE.Append(CPPPATH=['ExtLibs/lua/src', 'ExtLibs/noise/src']) 168 envCaWE.Append(LIBS = Split("SceneGraph MatSys cfsCoreLib cfsLib ClipSys cfs_png cfs_jpeg bulletcollision noise lua minizip lightwave z")) 169 170 if sys.platform=="win32": 171 envCaWE.Append(CPPPATH=['ExtLibs/freetype/include']) # Windows builds use our local copy, Linux builds (must) use the systems freetype library instead. 172 envCaWE.Append(LIBS = Split("freetype")) 173 envCaWE.Append(LIBS = Split("advapi32 comctl32 comdlg32 gdi32 ole32 oleaut32 opengl32 rpcrt4 shell32 user32 winspool wsock32")) 174 175 WinResource=envCaWE.RES("CaWE/CaWE.rc") 176 177 elif sys.platform=="linux2": 178 envCaWE.Append(CPPPATH=['/usr/include/freetype2']) # As of 2009-09-10, this line is to become unnecessary in the future, see /usr/include/ftbuild.h for details. 179 envCaWE.Append(LINKFLAGS = ['-Wl,--export-dynamic']) # Need this so that the Renderer DLLs can have their unresolved symbols dynamically resolved at load time. 180 181 WinResource=[] 182 183 SourceFilesList=(Glob("CaWE/*.cpp") 184 +Glob("CaWE/FontWizard/*.cpp") 185 +Glob("CaWE/GuiEditor/*.cpp")+Glob("CaWE/GuiEditor/Commands/*.cpp")+Glob("CaWE/GuiEditor/EditorData/*.cpp") 186 +Glob("CaWE/MapCommands/*.cpp") 187 +Glob("CaWE/MaterialBrowser/*.cpp") 188 +Glob("CaWE/ModelEditor/*.cpp") 189 +Glob("CaWE/wxExt/*.cpp") 190 +Glob("CaWE/wxFB/*.cpp")) 191 192 envCaWE.Program('CaWE/CaWE', SourceFilesList + WinResource + CommonWorldObject)
