Skip to content

Commit

Permalink
refactor(core): just for satify @flavien-chenu
Browse files Browse the repository at this point in the history
  • Loading branch information
Yann-Masson committed Apr 2, 2024
1 parent 0041e64 commit fd43875
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
add_executable(${PROJECT_NAME}
add_executable(arcade
main.cpp
)

target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/..)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src)
target_include_directories(arcade PUBLIC ${CMAKE_CURRENT_LIST_DIR}/..)
target_include_directories(arcade PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src)

add_subdirectory(src)
2 changes: 1 addition & 1 deletion core/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(${CMAKE_PROJECT_NAME} PRIVATE
target_sources(arcade PRIVATE
Core.cpp
Core.hpp
)
Expand Down
4 changes: 2 additions & 2 deletions core/src/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void Core::_handleWindowResize()
std::cout << "Window resized" << std::endl;
}

void Core::_handleKeyBoardEvents(std::vector<events::EventPtr> &events, std::shared_ptr<components::IKeyboardComponent> &component)
void Core::_handleKeyboardEvents(std::vector<events::EventPtr> &events, std::shared_ptr<components::IKeyboardComponent> &component)
{
for (auto &event : events) {
auto type = event->getType();
Expand Down Expand Up @@ -354,7 +354,7 @@ void Core::_handleComponentEvents(std::vector<events::EventPtr> &events, std::sh

if (type == components::KEYBOARD) {
auto keyboard = std::dynamic_pointer_cast<components::IKeyboardComponent>(component);
this->_handleKeyBoardEvents(events, keyboard);
this->_handleKeyboardEvents(events, keyboard);
}
if (type == components::TEXT || type == components::TEXTURE) {
auto displayable = std::dynamic_pointer_cast<components::IDisplayableComponent>(component);
Expand Down
8 changes: 6 additions & 2 deletions core/src/Core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class Core {
*/
void run();

protected:
private:

typedef struct {
Expand Down Expand Up @@ -157,7 +156,7 @@ class Core {
* @param events Events to handle
* @param component The keyboard component
*/
void _handleKeyBoardEvents(std::vector<events::EventPtr> &events, std::shared_ptr<components::IKeyboardComponent> &component);
void _handleKeyboardEvents(std::vector<events::EventPtr> &events, std::shared_ptr<components::IKeyboardComponent> &component);

/**
* @brief Handle the displayable events
Expand Down Expand Up @@ -265,5 +264,10 @@ class Core {
*/
components::IKeyboardComponent::KeyData _convertKeyPressData(events::IKeyEvent::KeyType type, events::IKeyEvent::KeyCode code);

/**
* @brief Handle the mouse button press event
*
* @param event The mouse button event
*/
void _handleSoundComponent(std::shared_ptr<components::ISoundComponent> &component);
};
2 changes: 1 addition & 1 deletion core/src/exception/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(${CMAKE_PROJECT_NAME} PRIVATE
target_sources(arcade PRIVATE
ArcadeError.cpp
ArcadeError.hpp
)
2 changes: 1 addition & 1 deletion core/src/loader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(${CMAKE_PROJECT_NAME} PRIVATE
target_sources(arcade PRIVATE
Loader.cpp
Loader.hpp
)
2 changes: 1 addition & 1 deletion core/src/types/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
target_sources(${CMAKE_PROJECT_NAME} PRIVATE
target_sources(arcade PRIVATE
Providers.hpp
)
2 changes: 1 addition & 1 deletion core/src/utils/DLLoader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
target_sources(${CMAKE_PROJECT_NAME} PRIVATE
target_sources(arcade PRIVATE
DLLoader.cpp
)

0 comments on commit fd43875

Please sign in to comment.