diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c3e8e4..b23028f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,5 +14,3 @@ set(CMAKE_SHARED_LIBRARY_PREFIX "arcade_") add_subdirectory(core) add_subdirectory(games) add_subdirectory(graphics) - -target_include_directories (arcade PUBLIC ${CMAKE_CURRENT_LIST_DIR}/common/) diff --git a/common/games/components/IComponent.hpp b/common/games/components/IComponent.hpp index a0be931..4ee1093 100644 --- a/common/games/components/IComponent.hpp +++ b/common/games/components/IComponent.hpp @@ -45,5 +45,5 @@ class shared::games::components::IComponent { * * @return Entity of the component */ - virtual std::shared_ptr getEntity() noexcept = 0; + virtual const entity::IEntity &getEntity() noexcept = 0; }; diff --git a/common/types/Libraries.hpp b/common/types/Libraries.hpp index 999c223..9711994 100644 --- a/common/types/Libraries.hpp +++ b/common/types/Libraries.hpp @@ -23,7 +23,7 @@ namespace shared::types GRAPHIC, } LibraryType; - typedef std::shared_ptr (*GameProvider)(void); - typedef std::shared_ptr (*GraphicsProvider)(void); + typedef std::shared_ptr (*GameProvider)(void); + typedef std::shared_ptr (*GraphicsProvider)(void); typedef LibraryType (*LibraryTypeGetter)(void); } diff --git a/common/types/types.hpp b/common/types/types.hpp index dcfa739..2fa7a26 100644 --- a/common/types/types.hpp +++ b/common/types/types.hpp @@ -9,4 +9,3 @@ #include "Vector.hpp" #include "UUId.hpp" -#include "Libraries.hpp" diff --git a/games/snake/CMakeLists.txt b/games/snake/CMakeLists.txt index dab7a02..619422c 100644 --- a/games/snake/CMakeLists.txt +++ b/games/snake/CMakeLists.txt @@ -1,5 +1,5 @@ -project(snake) - -add_library(${PROJECT_NAME} SHARED - src/main.cpp +add_library(snake SHARED + export.cpp ) +target_include_directories(snake PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src) +target_include_directories(snake PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../..) diff --git a/games/snake/export.cpp b/games/snake/export.cpp new file mode 100644 index 0000000..facedea --- /dev/null +++ b/games/snake/export.cpp @@ -0,0 +1,21 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** export +*/ + +#include "common/games/IGameProvider.hpp" +#include "common/types/Libraries.hpp" + +extern "C" { + shared::types::LibraryType SHARED_LIBRARY_TYPE_GETTER_NAME(void) + { + return shared::types::LibraryType::GAME; + } + +/* std::shared_ptr SHARED_GAME_PROVIDER_LOADER_NAME(void) + { + return std::make_shared(...) + }*/ +} diff --git a/games/snake/src/main.cpp b/games/snake/src/main.cpp deleted file mode 100644 index c17bdd9..0000000 --- a/games/snake/src/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -/* -** EPITECH PROJECT, 2024 -** arcade -** File description: -** main -*/ - -int main(int ac, char **av) -{ - (void) ac; - (void) av; - return 0; -} diff --git a/graphics/ncurses/CMakeLists.txt b/graphics/ncurses/CMakeLists.txt index fc9d7f8..8abe0ed 100644 --- a/graphics/ncurses/CMakeLists.txt +++ b/graphics/ncurses/CMakeLists.txt @@ -1,5 +1,5 @@ -project(ncurses) - -add_library(${PROJECT_NAME} SHARED - src/main.cpp +add_library(ncurses SHARED + export.cpp ) +target_include_directories(ncurses PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src) +target_include_directories(ncurses PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../..) diff --git a/graphics/ncurses/export.cpp b/graphics/ncurses/export.cpp new file mode 100644 index 0000000..4e047b7 --- /dev/null +++ b/graphics/ncurses/export.cpp @@ -0,0 +1,22 @@ +/* +** EPITECH PROJECT, 2024 +** arcade-shared +** File description: +** export +*/ + +#include "common/games/IGameProvider.hpp" +#include "common/types/Libraries.hpp" + +extern "C" { + shared::types::LibraryType SHARED_LIBRARY_TYPE_GETTER_NAME(void) + { + return shared::types::LibraryType::GRAPHIC; + } + +/* std::shared_ptr SHARED_GRAPHICS_PROVIDER_LOADER_NAME(void) + { + return std::make_shared(...); + }*/ +} + diff --git a/graphics/ncurses/src/main.cpp b/graphics/ncurses/src/main.cpp deleted file mode 100644 index c17bdd9..0000000 --- a/graphics/ncurses/src/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -/* -** EPITECH PROJECT, 2024 -** arcade -** File description: -** main -*/ - -int main(int ac, char **av) -{ - (void) ac; - (void) av; - return 0; -}