From 4b9f323686d1ac80ea69ef090a704ebef2ae28e3 Mon Sep 17 00:00:00 2001 From: Joseph Walton-Rivers <joseph@walton-rivers.uk> Date: Mon, 27 Jun 2022 09:56:21 +0100 Subject: [PATCH] fix bullet-dependent includes --- demo/demo/main.cpp | 9 +++++++-- fggl/scenes/game.cpp | 11 ++++++++--- include/fggl/phys/types.hpp | 1 + .../bullet/include/fggl/phys/bullet/bullet.hpp | 4 +++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/demo/demo/main.cpp b/demo/demo/main.cpp index a5d78bd..38942cf 100644 --- a/demo/demo/main.cpp +++ b/demo/demo/main.cpp @@ -21,6 +21,10 @@ #include <filesystem> #include <iostream> +#if __has_include("fggl/phys/bullet/bullet.hpp") + #include "fggl/phys/bullet/bullet.hpp" +#endif + #include "fggl/app.hpp" #include "fggl/audio/openal/audio.hpp" @@ -34,7 +38,6 @@ #include "fggl/platform/paths.hpp" #include "fggl/ecs3/types.hpp" -#include "../../integrations/bullet/include/fggl/phys/bullet/bullet.hpp" #include "fggl/scenes/menu.hpp" @@ -103,7 +106,9 @@ int main(int argc, const char* argv[]) { // load a bunch of modules to provide game functionality //app.use<fggl::ecs3::ecsTypes>(); app.use<fggl::gfx::SceneUtils>(); - app.use<fggl::phys::Bullet3>(); + #ifdef FGGL_MODULE_BULLET + app.use<FGGL_MODULE_BULLET>(); + #endif test_atlas_api(); diff --git a/fggl/scenes/game.cpp b/fggl/scenes/game.cpp index dfd22b7..6059ad5 100644 --- a/fggl/scenes/game.cpp +++ b/fggl/scenes/game.cpp @@ -18,7 +18,10 @@ #include "fggl/scenes/game.hpp" #include "fggl/util/service.hpp" -#include "../../integrations/bullet/include/fggl/phys/bullet/types.hpp" + +#if __has_include("fggl/phys/bullet/bullet.hpp") + #include "fggl/phys/bullet/bullet.hpp" +#endif namespace fggl::scenes { @@ -33,8 +36,10 @@ namespace fggl::scenes { // setup the scene m_world = std::make_unique<ecs3::World>(*m_owner.registry()); - // FIXME this ties bullet to the game state - which shouldn't be the case - m_phys = std::make_unique<phys::bullet::BulletPhysicsEngine>(m_world.get()); + #ifdef FGGL_MODULE_BULLET + // FIXME this ties bullet to the game state - which shouldn't be the case + m_phys = std::make_unique<fggl::phys::bullet::BulletPhysicsEngine>(m_world.get()); + #endif } void Game::deactivate() { diff --git a/include/fggl/phys/types.hpp b/include/fggl/phys/types.hpp index 09d0307..bbc2b46 100644 --- a/include/fggl/phys/types.hpp +++ b/include/fggl/phys/types.hpp @@ -19,6 +19,7 @@ #ifndef FGGL_PHYS_TYPES_HPP #define FGGL_PHYS_TYPES_HPP +#include "fggl/math/types.hpp" #include "fggl/phys/callbacks.hpp" namespace fggl::phys { diff --git a/integrations/bullet/include/fggl/phys/bullet/bullet.hpp b/integrations/bullet/include/fggl/phys/bullet/bullet.hpp index 73db6fd..fb28ce6 100644 --- a/integrations/bullet/include/fggl/phys/bullet/bullet.hpp +++ b/integrations/bullet/include/fggl/phys/bullet/bullet.hpp @@ -33,10 +33,12 @@ #ifndef FGGL_PHYS_BULLET_BULLET_HPP #define FGGL_PHYS_BULLET_BULLET_HPP +#define FGGL_MODULE_BULLET fggl::phys::Bullet3 + #include "fggl/ecs3/module/module.hpp" #include "fggl/phys/types.hpp" -#include "types.hpp" +#include "fggl/phys/bullet/types.hpp" namespace fggl::phys::bullet { -- GitLab