feat: fixed build on windows#55
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request refactors the Bullet physics engine and GLEW/SFML renderer to improve code organization through better separation of concerns. It also addresses Windows build issues by standardizing export macros and adding vcpkg toolchain configuration.
Changes:
- Introduced
BulletBodyManagerandBulletWorldclasses to encapsulate rigid body and physics world management, removing this logic fromBulletPhysicEngine - Created
ResourceManagerandParticleSystemclasses to handle mesh/texture loading and particle rendering, extracted fromGLEWSFMLRenderer - Standardized Windows DLL export macros for module entry points across NetworkManager, BasicECSSavesManager, BulletPhysicEngine, and GLEWSFMLRenderer
- Added vcpkg CMake toolchain configuration and debugging output for troubleshooting
Reviewed changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/game/client/main.cpp | Added catch-all exception handler and duplicate error logging |
| src/engine/app/AApplication.cpp | Added debug output statements to main application loop |
| src/engine/modules/WindowManager/SFML/SFMLWindowManager.cpp | Added window context activation/deactivation around drawing operations |
| src/engine/modules/Renderer/GLEWSFML/ResourceManager.hpp | New header defining ResourceManager class for mesh/texture management |
| src/engine/modules/Renderer/GLEWSFML/ResourceManager.cpp | New implementation of resource loading with OpenGL context management |
| src/engine/modules/Renderer/GLEWSFML/RenderStructs.hpp | New header extracting render-related structs from main renderer |
| src/engine/modules/Renderer/GLEWSFML/ParticleSystem.hpp | New header defining ParticleSystem class for particle management |
| src/engine/modules/Renderer/GLEWSFML/ParticleSystem.cpp | New implementation of particle system update and rendering |
| src/engine/modules/Renderer/GLEWSFML/GLEWSFMLRenderer.hpp | Refactored to use ResourceManager and ParticleSystem members |
| src/engine/modules/Renderer/GLEWSFML/GLEWSFMLRenderer.cpp | Delegated resource and particle operations to new helper classes |
| src/engine/modules/Renderer/GLEWSFML/CMakeLists.txt | Added new source files to build configuration |
| src/engine/modules/PhysicEngine/Bullet/BulletWorld.hpp | New header defining BulletWorld class for physics world management |
| src/engine/modules/PhysicEngine/Bullet/BulletWorld.cpp | New implementation of Bullet physics world lifecycle |
| src/engine/modules/PhysicEngine/Bullet/BulletBodyManager.hpp | New header defining BulletBodyManager for rigid body management |
| src/engine/modules/PhysicEngine/Bullet/BulletBodyManager.cpp | New implementation of body creation, destruction, and property manipulation |
| src/engine/modules/PhysicEngine/Bullet/BulletPhysicEngine.hpp | Refactored to use BulletWorld and BulletBodyManager members |
| src/engine/modules/PhysicEngine/Bullet/BulletPhysicEngine.cpp | Delegated physics operations to helper classes, moved export macro |
| src/engine/modules/PhysicEngine/Bullet/CMakeLists.txt | Added new source files to build configuration |
| src/engine/modules/NetworkManager/NetworkManager.cpp | Moved export macro definition after namespace closure |
| src/engine/modules/ECSSavesManager/BasicECSSavesManager/BasicECSSavesManager.cpp | Moved export macro definition after namespace closure |
| assets/scripts/space-shooter/systems/MenuSystem.lua | Fixed trailing whitespace formatting |
| CMakePresets.json | Added CMAKE_TOOLCHAIN_FILE for vcpkg integration on Windows |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| GLXContext oldContext = glXGetCurrentContext(); | ||
| GLXDrawable oldDrawable = glXGetCurrentDrawable(); | ||
| #endif | ||
| (void)oldContext; // suppress unused warning if not used in some paths |
There was a problem hiding this comment.
The unused variable warning suppression using (void)oldContext may not work as intended. On Linux, the oldContext variable is actually used in the restoration logic (lines 303-306), so this suppression is misleading. The comment on line 201 incorrectly states it may not be used in some paths.
| (void)oldContext; // suppress unused warning if not used in some paths |
| ResourceManager::ResourceManager(void*& hdc, void*& hwnd, void*& hglrc) | ||
| : _hdc(hdc), _hwnd(hwnd), _hglrc(hglrc) {} |
There was a problem hiding this comment.
The ResourceManager constructor takes void*& references to hdc, hwnd, and hglrc, but these are stored as references to member variables. This creates a dependency where the ResourceManager must outlive or be constructed with references that remain valid throughout its lifetime. Consider if these should be regular pointers instead of references to avoid lifetime issues.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
….cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request refactors the Bullet physics engine integration to improve code organization and modularity, primarily by introducing a new
BulletBodyManagerclass to encapsulate rigid body management. It also updates platform-specific export macros for module creation and adds debugging output to the main application loop.Physics Engine Refactor and Modularization
BulletBodyManager(BulletBodyManager.hpp,BulletBodyManager.cpp) to handle creation, destruction, and management of rigid bodies, moving related logic out ofBulletPhysicEngine. This improves encapsulation and simplifies the physics engine code. [1] [2]BulletPhysicEngine(BulletPhysicEngine.cpp) to useBulletBodyManagerandBulletWorld, removing direct management of bodies and Bullet world objects. Updated methods such asinit,cleanup,loop,stepSimulation,checkCollisions, andsendUpdatesto delegate responsibilities to the new manager and world classes. [1] [2] [3] [4] [5] [6]Platform Export Macros
__declspec(dllexport)) for module entry points inBasicECSSavesManager.cppandNetworkManager.cpp, ensuring correct symbol export for dynamic loading on Windows. [1] [2] [3]Build Configuration
CMAKE_TOOLCHAIN_FILEto the Windows build preset inCMakePresets.jsonfor proper vcpkg integration, improving build reliability and portability.Debugging and Logging
AApplication.cppto aid in runtime diagnostics and troubleshooting.