Changeset 114

Show
Ignore:
Timestamp:
08/12/10 16:39:08 (18 months ago)
Author:
Carsten
Message:

Liberated a lot of code from knowing the obsolete OpenGLWindowT class (and thus its related SingleOpenGLWindow global pointer)
and the also obsolete, related DirectX code.

Location:
cafu/branches/cafu_to_wx
Files:
2 removed
10 modified

Legend:

Unmodified
Added
Removed
  • cafu/branches/cafu_to_wx/Ca3DE/Client/ScrlInfo.cpp

    r36 r114  
    8585 
    8686 
    87 void ScrollInfoT::Draw(FontT& Font, unsigned long PosX, unsigned long PosY) const 
     87void ScrollInfoT::Draw(FontT& Font, unsigned long PosX, unsigned long PosY, float FrameWidth, float FrameHeight) const 
    8888{ 
    8989    if (NrOfLines==0) return; 
    9090 
    91     Font.AccPrintBegin(); 
     91    Font.AccPrintBegin(FrameWidth, FrameHeight); 
    9292 
    9393    for (char LineNr=0; LineNr<NrOfLines; LineNr++) 
  • cafu/branches/cafu_to_wx/Ca3DE/Client/ScrlInfo.hpp

    r36 r114  
    5050    ScrollInfoT(); 
    5151    void Print(const char* PrintString, ...); 
    52     void Draw(FontT& Font, unsigned long PosX, unsigned long PosY) const; 
     52    void Draw(FontT& Font, unsigned long PosX, unsigned long PosY, float FrameWidth, float FrameHeight) const; 
    5353    void AdvanceTime(float FrameTime); 
    5454}; 
  • cafu/branches/cafu_to_wx/CaTools/MaterialViewer.cpp

    r113 r114  
    504504 
    505505 
    506             MyFont->Print(SingleOpenGLWindow->GetWidth()-100, SingleOpenGLWindow->GetHeight()-18, 0x00FFFFFF, "%5.1f FPS", 1.0/DeltaTime); 
     506            MyFont->Print(SingleOpenGLWindow->GetWidth()-100, SingleOpenGLWindow->GetHeight()-18, float(SingleOpenGLWindow->GetWidth()), float(SingleOpenGLWindow->GetHeight()), 0x00FFFFFF, "%5.1f FPS", 1.0/DeltaTime); 
    507507        } 
    508508        MatSys::Renderer->EndFrame(); 
  • cafu/branches/cafu_to_wx/Games/DeathMatch/Code/DeathMatch.cpp

    r113 r114  
    3636#include "MaterialSystem/Renderer.hpp" 
    3737#include "MaterialSystem/TextureMap.hpp" 
    38 #include "OpenGL/OpenGLWindow.hpp" 
    3938#include "TypeSys.hpp" 
    4039#include "SoundSystem/SoundShaderManager.hpp" 
     
    9291#ifdef _WIN32 
    9392// Under Linux (where DLLs are shared objects), these all resolve to their counterparts in the main executable. 
    94 SingleOpenGLWindowT*   SingleOpenGLWindow=NULL; 
    9593cf::GuiSys::GuiManI*   cf::GuiSys::GuiMan=NULL;     // Define the global GuiMan pointer instance -- see GuiMan.hpp for more details. 
    9694MaterialManagerI*      MaterialManager   =NULL; 
     
    106104// WARNING: When the signature of GetGame() is changed here (e.g. by adding more interface pointer parameters), 
    107105// grep all C++ source code files for "GetGame@", because the number of parameter bytes must be updated there! 
    108 DLL_EXPORT cf::GameSys::GameI* __stdcall GetGame(SingleOpenGLWindowT* SingleWin, MatSys::RendererI* Renderer, MatSys::TextureMapManagerI* TexMapMan, MaterialManagerI* MatMan, cf::GuiSys::GuiManI* GuiMan_, cf::ConsoleI* Console_, ConsoleInterpreterI* ConInterpreter_, cf::ClipSys::CollModelManI* CollModelMan_, SoundSysI* SoundSystem_, SoundShaderManagerI* SoundShaderManager_) 
     106DLL_EXPORT cf::GameSys::GameI* __stdcall GetGame(MatSys::RendererI* Renderer, MatSys::TextureMapManagerI* TexMapMan, MaterialManagerI* MatMan, cf::GuiSys::GuiManI* GuiMan_, cf::ConsoleI* Console_, ConsoleInterpreterI* ConInterpreter_, cf::ClipSys::CollModelManI* CollModelMan_, SoundSysI* SoundSystem_, SoundShaderManagerI* SoundShaderManager_) 
    109107{ 
    110108#ifdef _WIN32 
    111109    // Under Linux (where DLLs are shared objects), these all resolve to their counterparts in the main executable. 
    112     SingleOpenGLWindow       =SingleWin; 
    113110    MatSys::Renderer         =Renderer; 
    114111    MatSys::TextureMapManager=TexMapMan; 
  • cafu/branches/cafu_to_wx/Games/DeathMatch/Code/HumanPlayer.cpp

    r91 r114  
    10241024            { 
    10251025                case StateOfExistance_Dead: 
    1026                     HUD_Font1.Print(50, SingleOpenGLWindow->GetHeight()/2-4, 0x00FF0000, "You're dead."); 
     1026                    HUD_Font1.Print(50, 1024/2-4, 800.0f, 600.0f, 0x00FF0000, "You're dead."); 
    10271027                    break; 
    10281028 
    10291029                case StateOfExistance_FrozenSpectator: 
    1030                     HUD_Font1.Print(50, SingleOpenGLWindow->GetHeight()/2+16, 0x00FF0000, "Press FIRE (left mouse button) to respawn!"); 
     1030                    HUD_Font1.Print(50, 1024/2+16, 800.0f, 600.0f, 0x00FF0000, "Press FIRE (left mouse button) to respawn!"); 
    10311031                    break; 
    10321032            } 
  • cafu/branches/cafu_to_wx/Games/VSWM/Code/HumanPlayer.cpp

    r51 r114  
    2323#include "MaterialSystem/Renderer.hpp" 
    2424#include "Math3D/Matrix.hpp" 
    25 #include "OpenGL/OpenGLWindow.hpp" 
    2625#include "TextParser/TextParser.hpp" 
    2726 
     
    858857                    // is made from a prediction Think()ing, or a real server-side Think()ing. 
    859858                    // In the worst case (with prediction), the quit message is posted multiple times. 
    860                     if (SingleOpenGLWindow) SingleOpenGLWindow->PostQuitMessage(); 
     859                    // if (SingleOpenGLWindow) SingleOpenGLWindow->PostQuitMessage();   // FIXME: Set ConVar "quit" to true instead! 
    861860 
    862861                    if (FrameTime>=0.0 && LogFile!=NULL) 
     
    947946                    // is made from a prediction Think()ing, or a real server-side Think()ing. 
    948947                    // In the worst case (with prediction), the quit message is posted multiple times. 
    949                     if (SingleOpenGLWindow) SingleOpenGLWindow->PostQuitMessage(); 
     948                    // if (SingleOpenGLWindow) SingleOpenGLWindow->PostQuitMessage();   // FIXME: Set ConVar "quit" to true instead! 
    950949 
    951950                    if (FrameTime>=0.0 && LogFile!=NULL) 
     
    12951294                static FontT Font1("Fonts/Arial"); 
    12961295                const float  TimeRemaining=3.0f-float(State.Velocity.x); 
    1297  
    1298                      if (TimeRemaining>=2.0) Font1.Print(SingleOpenGLWindow->GetWidth()/2-47, SingleOpenGLWindow->GetHeight()/2, 0x00FF0000, "   3   "); 
    1299                 else if (TimeRemaining>=1.0) Font1.Print(SingleOpenGLWindow->GetWidth()/2-47, SingleOpenGLWindow->GetHeight()/2, 0x00FF0000, "   2   "); 
    1300                 else if (TimeRemaining>=0.0) Font1.Print(SingleOpenGLWindow->GetWidth()/2-47, SingleOpenGLWindow->GetHeight()/2, 0x00FF0000, "   1   "); 
    1301              // else if (TimeRemaining>=0.0) Font1.Print(SingleOpenGLWindow->GetWidth()/2-47, SingleOpenGLWindow->GetHeight()/2, 0x00FF0000, "  Go!  "); 
     1296                const int FrameWidth =1024; 
     1297                const int FrameHeight= 786; 
     1298 
     1299                     if (TimeRemaining>=2.0) Font1.Print(FrameWidth/2-47, FrameHeight/2, float(FrameWidth), float(FrameHeight), 0x00FF0000, "   3   "); 
     1300                else if (TimeRemaining>=1.0) Font1.Print(FrameWidth/2-47, FrameHeight/2, float(FrameWidth), float(FrameHeight), 0x00FF0000, "   2   "); 
     1301                else if (TimeRemaining>=0.0) Font1.Print(FrameWidth/2-47, FrameHeight/2, float(FrameWidth), float(FrameHeight), 0x00FF0000, "   1   "); 
     1302             // else if (TimeRemaining>=0.0) Font1.Print(FrameWidth/2-47, FrameHeight/2, float(FrameWidth), float(FrameHeight), 0x00FF0000, "  Go!  "); 
    13021303                else 
    13031304                { 
    13041305                    // OLD CODE (yes, it was only one line): 
    1305                     // Font1.Print(SingleOpenGLWindow->GetWidth()/2-75, SingleOpenGLWindow->GetHeight()/2, 0x00FF0000, "Ready!"); 
     1306                    // Font1.Print(FrameWidth/2-75, FrameHeight/2, float(FrameWidth), float(FrameHeight), 0x00FF0000, "Ready!"); 
    13061307 
    13071308                    static const std::string        HudImgMatName="Hud/Ready"; 
     
    13161317                    MatSys::Renderer->SetMatrix(MatSys::RendererI::MODEL_TO_WORLD, MatrixT()); 
    13171318                    MatSys::Renderer->SetMatrix(MatSys::RendererI::WORLD_TO_VIEW,  MatrixT()); 
    1318                     MatSys::Renderer->SetMatrix(MatSys::RendererI::PROJECTION,     MatrixT::GetProjOrthoMatrix(0.0f, float(SingleOpenGLWindow->GetWidth()), float(SingleOpenGLWindow->GetHeight()), 0.0f, -1.0f, 1.0f)); 
     1319                    MatSys::Renderer->SetMatrix(MatSys::RendererI::PROJECTION,     MatrixT::GetProjOrthoMatrix(0.0f, float(FrameWidth), float(FrameHeight), 0.0f, -1.0f, 1.0f)); 
    13191320 
    13201321                    static MatSys::MeshT TextMesh(MatSys::MeshT::Quads); 
     
    13251326                    const unsigned long h=HudImgHeight/2; 
    13261327 
    1327                     TextMesh.Vertices[0].SetOrigin(SingleOpenGLWindow->GetWidth()/2-w, SingleOpenGLWindow->GetHeight()/2-h); TextMesh.Vertices[0].SetTextureCoord(0.0f, 0.0f); 
    1328                     TextMesh.Vertices[1].SetOrigin(SingleOpenGLWindow->GetWidth()/2+w, SingleOpenGLWindow->GetHeight()/2-h); TextMesh.Vertices[1].SetTextureCoord(1.0f, 0.0f); 
    1329                     TextMesh.Vertices[2].SetOrigin(SingleOpenGLWindow->GetWidth()/2+w, SingleOpenGLWindow->GetHeight()/2+h); TextMesh.Vertices[2].SetTextureCoord(1.0f, 1.0f); 
    1330                     TextMesh.Vertices[3].SetOrigin(SingleOpenGLWindow->GetWidth()/2-w, SingleOpenGLWindow->GetHeight()/2+h); TextMesh.Vertices[3].SetTextureCoord(0.0f, 1.0f); 
     1328                    TextMesh.Vertices[0].SetOrigin(FrameWidth/2-w, FrameHeight/2-h); TextMesh.Vertices[0].SetTextureCoord(0.0f, 0.0f); 
     1329                    TextMesh.Vertices[1].SetOrigin(FrameWidth/2+w, FrameHeight/2-h); TextMesh.Vertices[1].SetTextureCoord(1.0f, 0.0f); 
     1330                    TextMesh.Vertices[2].SetOrigin(FrameWidth/2+w, FrameHeight/2+h); TextMesh.Vertices[2].SetTextureCoord(1.0f, 1.0f); 
     1331                    TextMesh.Vertices[3].SetOrigin(FrameWidth/2-w, FrameHeight/2+h); TextMesh.Vertices[3].SetTextureCoord(0.0f, 1.0f); 
    13311332 
    13321333                    MatSys::Renderer->SetCurrentMaterial(HudImgRM); 
  • cafu/branches/cafu_to_wx/Games/VSWM/Code/VSWM.cpp

    r113 r114  
    1313#include "MaterialSystem/Renderer.hpp" 
    1414#include "MaterialSystem/TextureMap.hpp" 
    15 #include "OpenGL/OpenGLWindow.hpp" 
    1615 
    1716#include "EntityCreateParams.hpp" 
     
    249248// by the client. The parameters to this function however are always non-volatile, they don't change over multiple calls. 
    250249// In future implementations I'll possibly change this and load and init the DLL only once, even before the client or server gets instantiated. 
    251 SingleOpenGLWindowT*   SingleOpenGLWindow=NULL; 
    252250cf::GuiSys::GuiManI*   cf::GuiSys::GuiMan=NULL;     // Define the global GuiMan pointer instance -- see GuiMan.hpp for more details. 
    253251MaterialManagerI*      MaterialManager   =NULL; 
     
    256254cf::FileSys::FileManI* cf::FileSys::FileMan=NULL; 
    257255 
    258 DLL_EXPORT void __stdcall InitInterfaces(SingleOpenGLWindowT* SingleWin, MatSys::RendererI* Renderer, MatSys::TextureMapManagerI* TexMapMan, MaterialManagerI* MatMan, cf::GuiSys::GuiManI* GuiMan_, cf::ConsoleI* Console_, ConsoleInterpreterI* ConInterpreter_) 
    259 { 
    260     SingleOpenGLWindow       =SingleWin; 
     256DLL_EXPORT void __stdcall InitInterfaces(MatSys::RendererI* Renderer, MatSys::TextureMapManagerI* TexMapMan, MaterialManagerI* MatMan, cf::GuiSys::GuiManI* GuiMan_, cf::ConsoleI* Console_, ConsoleInterpreterI* ConInterpreter_) 
     257{ 
    261258    MatSys::Renderer         =Renderer; 
    262259    MatSys::TextureMapManager=TexMapMan; 
  • cafu/branches/cafu_to_wx/Libs/Fonts/Font.cpp

    r101 r114  
    3636#include "MaterialSystem/Renderer.hpp" 
    3737#include "Math3D/Matrix.hpp" 
    38 #include "OpenGL/OpenGLWindow.hpp" 
    3938 
    4039#if defined(_WIN32) 
     
    7675 
    7776 
    78 void FontT::Print(int PosX, int PosY, unsigned long Color, const char* PrintString, ...) 
     77void FontT::Print(int PosX, int PosY, float FrameWidth, float FrameHeight, unsigned long Color, const char* PrintString, ...) 
    7978{ 
    8079    if (!PrintString) return; 
     
    8786    va_end(ArgList); 
    8887 
    89     AccPrintBegin(); 
     88    AccPrintBegin(FrameWidth, FrameHeight); 
    9089    AccPrint(PosX, PosY, Color, PrintBuffer); 
    9190    AccPrintEnd(); 
     
    9392 
    9493 
    95 void FontT::AccPrintBegin() 
     94void FontT::AccPrintBegin(float FrameWidth, float FrameHeight) 
    9695{ 
    9796    // Save the current matrices. 
     
    10099    MatSys::Renderer->PushMatrix(MatSys::RendererI::WORLD_TO_VIEW ); 
    101100 
    102     MatSys::Renderer->SetMatrix(MatSys::RendererI::PROJECTION,     MatrixT::GetProjOrthoMatrix(0.0f, float(SingleOpenGLWindow->GetWidth()), float(SingleOpenGLWindow->GetHeight()), 0.0f, -1.0f, 1.0f)); 
     101    MatSys::Renderer->SetMatrix(MatSys::RendererI::PROJECTION,     MatrixT::GetProjOrthoMatrix(0.0f, FrameWidth, FrameHeight, 0.0f, -1.0f, 1.0f)); 
    103102 // MatSys::Renderer->SetMatrix(MatSys::RendererI::MODEL_TO_WORLD, MatrixT());      // Set below, in AccPrint(). 
    104103    MatSys::Renderer->SetMatrix(MatSys::RendererI::WORLD_TO_VIEW,  MatrixT()); 
  • cafu/branches/cafu_to_wx/Libs/Fonts/Font.hpp

    r36 r114  
    5555 
    5656    /// Prints PrintString at (PosX, PosY) in color Color. 
    57     void Print(int PosX, int PosY, unsigned long Color, const char* PrintString, ...); 
     57    void Print(int PosX, int PosY, float FrameWidth, float FrameHeight, unsigned long Color, const char* PrintString, ...); 
    5858 
    5959    /// Accumulative printing functions. Faster if you have to call Print() a lot. 
    60     void AccPrintBegin(); 
     60    void AccPrintBegin(float FrameWidth, float FrameHeight); 
    6161    void AccPrint(int PosX, int PosY, unsigned long Color, const char* PrintString, ...); 
    6262    void AccPrintEnd(); 
  • cafu/branches/cafu_to_wx/Libs/SConscript

    r113 r114  
    2525 
    2626 
    27 if sys.platform=="win32": 
    28     Win32Objects=env.Object("DirectX/DirectInput.cpp", CPPPATH=env['CPPPATH']+["#/ExtLibs/DirectX7/include"]) 
    29 else: 
    30     Win32Objects=[] 
    31  
    3227env.StaticLibrary( 
    3328    target="cfsCoreLib", 
     
    3631                    GuiSys/ConsoleByWindow.cpp GuiSys/Coroutines.cpp GuiSys/InitWindowTypes.cpp GuiSys/GuiImpl.cpp GuiSys/GuiManImpl.cpp 
    3732                    GuiSys/Window.cpp GuiSys/WindowCreateParams.cpp GuiSys/WindowChoice.cpp GuiSys/WindowEdit.cpp GuiSys/WindowListBox.cpp GuiSys/WindowModel.cpp GuiSys/WindowPtr.cpp GuiSys/EditorData.cpp 
    38                     FileSys/FileManImpl.cpp FileSys/FileSys_LocalPath.cpp FileSys/FileSys_ZipArchive_GV.cpp FileSys/File_local.cpp FileSys/File_memory.cpp FileSys/Password.cpp""") + 
    39            env.Object("OpenGL/OpenGLWindow.cpp", CPPPATH=env['CPPPATH']+["#/ExtLibs/DirectX7/include"]) + 
    40            Win32Objects, 
     33                    FileSys/FileManImpl.cpp FileSys/FileSys_LocalPath.cpp FileSys/FileSys_ZipArchive_GV.cpp FileSys/File_local.cpp FileSys/File_memory.cpp FileSys/Password.cpp"""), 
    4134    CPPPATH=env['CPPPATH']+["#/ExtLibs/bullet/src",    # For the BulletAdapterT classes. 
    4235                            "#/ExtLibs/lua/src", "#/ExtLibs/zlib"]) 
     36 
     37 
     38 
     39# This library is obsolete, and only used for our legacy programs in CaTools. 
     40if sys.platform=="win32": 
     41    env.StaticLibrary(target="cfsOpenGL", 
     42        source=["OpenGL/OpenGLWindow.cpp", "DirectX/DirectInput.cpp"], 
     43        CPPPATH=env['CPPPATH']+["#/ExtLibs/DirectX7/include"]) 
     44else: 
     45    env.StaticLibrary(target="cfsOpenGL", source="OpenGL/OpenGLWindow.cpp") 
    4346 
    4447