-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: System Interface and Abstract with some system class (Collison a…
…nd Movement) Add: SystemManager class Modif: CMakeLists for compilation
- Loading branch information
Showing
12 changed files
with
299 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
** ASystem.cpp for R-Bus in /home/kitetsu/Epitech/R-Bus/src/system | ||
** | ||
** Made by brice | ||
** Login <[email protected]> | ||
** | ||
** Started on Tue Sep 19 5:18:32 PM 2023 brice | ||
** Last update Thu Sep 20 9:37:48 AM 2023 brice | ||
*/ | ||
|
||
#include "ASystem.hpp" | ||
|
||
namespace System { | ||
|
||
ASystem::ASystem(const Registry ®istry) | ||
: _registry(registry) | ||
{ | ||
|
||
} | ||
|
||
void ASystem::clientRun() | ||
{ | ||
// To fill when network is ok | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
** ASystem.hpp for R-Bus in /home/kitetsu/Epitech/R-Bus/src/system | ||
** | ||
** Made by brice | ||
** Login <[email protected]> | ||
** | ||
** Started on Tue Sep 19 5:18:35 PM 2023 brice | ||
** Last update Thu Sep 20 9:57:34 AM 2023 brice | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "ISystem.hpp" | ||
#include "Registry.hpp" | ||
|
||
namespace System { | ||
class ASystem : public ISystem { | ||
public: | ||
ASystem(const Registry ®istry); | ||
~ASystem() = default; | ||
|
||
protected: | ||
private: | ||
void clientRun() final; | ||
|
||
Registry _registry; | ||
|
||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cmake_minimum_required(VERSION 3.27) | ||
|
||
target_include_directories( | ||
${PROJECT_NAME} | ||
PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
) | ||
|
||
target_sources( | ||
${PROJECT_NAME} | ||
PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
${CMAKE_CURRENT_SOURCE_DIR}/Collison.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/Movement.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/ASystem.cpp | ||
) | ||
|
||
add_subdirectory(managers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
** Collison.cpp for R-Bus in /home/kitetsu/Epitech/R-Bus/src/system | ||
** | ||
** Made by brice | ||
** Login <[email protected]> | ||
** | ||
** Started on Wed Sep 20 9:36:31 AM 2023 brice | ||
** Last update Thu Sep 20 12:03:08 PM 2023 brice | ||
*/ | ||
|
||
#include <iostream> | ||
#include "Collison.hpp" | ||
|
||
namespace System { | ||
|
||
Collison::Collison(const Registry ®istry) | ||
: ASystem(registry) | ||
{ | ||
|
||
} | ||
|
||
void Collison::run() | ||
{ | ||
std::cout << "Update Collision" << std::endl; | ||
// get Position sparseArray with Position component type index | ||
//h | ||
// get Dammage sparseArray with Dammage component type index | ||
// get Health sparse Array with Health component type index | ||
|
||
// if (sparseArray.size() == 0) { | ||
// return () | ||
// } | ||
// for (std::size_t i = 0, auto it = sparseArray.begin(); it != sparseArray.end(); it++) { | ||
// Position toCheck = sparseArray[i]; | ||
// auto tmp = it; | ||
// for (; tmp != sparseArray.end(); tmp++) { | ||
// if () | ||
// } | ||
//} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
** Collison.hpp for R-Bus in /home/kitetsu/Epitech/R-Bus/src/system | ||
** | ||
** Made by brice | ||
** Login <[email protected]> | ||
** | ||
** Started on Wed Sep 20 9:36:35 AM 2023 brice | ||
** Last update Thu Sep 20 9:58:17 AM 2023 brice | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "ASystem.hpp" | ||
|
||
namespace System { | ||
class Collison : public ASystem { | ||
public: | ||
Collison(const Registry ®istry); | ||
|
||
void run() final; | ||
protected: | ||
private: | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
** ISystem.hpp for R-Bus in /home/kitetsu/Epitech/R-Bus/src/system | ||
** | ||
** Made by brice | ||
** Login <[email protected]> | ||
** | ||
** Started on Tue Sep 19 5:13:48 PM 2023 brice | ||
** Last update Thu Sep 20 9:54:30 AM 2023 brice | ||
*/ | ||
|
||
#pragma once | ||
|
||
namespace System { | ||
class ISystem { | ||
public: | ||
virtual ~ISystem() = default; | ||
|
||
virtual void run() = 0; | ||
|
||
protected: | ||
private: | ||
virtual void clientRun() = 0; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
** Movement.cpp for R-Bus in /home/kitetsu/Epitech/R-Bus/src/system | ||
** | ||
** Made by brice | ||
** Login <[email protected]> | ||
** | ||
** Started on Wed Sep 20 10:19:53 AM 2023 brice | ||
** Last update Thu Sep 20 2:34:00 PM 2023 brice | ||
*/ | ||
|
||
#include <iostream> | ||
#include "Movement.hpp" | ||
|
||
namespace System { | ||
Movement::Movement(const Registry ®istry) | ||
: ASystem(registry) | ||
{ | ||
|
||
} | ||
|
||
void Movement::run() | ||
{ | ||
std::cout << "Update Movement" << std::endl; | ||
// get Position sparseArray with Position component type index | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
** Movement.hpp for R-Bus in /home/kitetsu/Epitech/R-Bus/src/system | ||
** | ||
** Made by brice | ||
** Login <[email protected]> | ||
** | ||
** Started on Wed Sep 20 10:19:50 AM 2023 brice | ||
** Last update Thu Sep 20 10:28:46 AM 2023 brice | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "ASystem.hpp" | ||
|
||
namespace System { | ||
class Movement : public ASystem { | ||
public: | ||
Movement(const Registry ®istry); | ||
|
||
void run() final; | ||
protected: | ||
private: | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
cmake_minimum_required(VERSION 3.27) | ||
|
||
target_include_directories( | ||
${PROJECT_NAME} | ||
PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
) | ||
|
||
target_sources( | ||
${PROJECT_NAME} | ||
PRIVATE | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
${CMAKE_CURRENT_SOURCE_DIR}/SystemManager.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
** SystemManager.cpp for R-Bus in /home/kitetsu/Epitech/R-Bus/src/system/managers | ||
** | ||
** Made by brice | ||
** Login <[email protected]> | ||
** | ||
** Started on Wed Sep 20 10:25:26 AM 2023 brice | ||
** Last update Thu Sep 20 2:34:27 PM 2023 brice | ||
*/ | ||
|
||
#include "SystemManager.hpp" | ||
|
||
|
||
namespace System { | ||
SystemManager::SystemManager(Registry ®istry) | ||
{ | ||
} | ||
|
||
SystemManager::~SystemManager() | ||
{ | ||
} | ||
|
||
void SystemManager::updateSystems() | ||
{ | ||
for (auto &system : _systems) { | ||
system->run(); | ||
} | ||
} | ||
|
||
void addSystems(std::vector<std::unique_ptr<ISystem>> systems) | ||
{ | ||
for (auto &system: systems) { | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
** SystemManager.hpp for R-Bus in /home/kitetsu/Epitech/R-Bus/src/system/managers | ||
** | ||
** Made by brice | ||
** Login <[email protected]> | ||
** | ||
** Started on Wed Sep 20 10:25:23 AM 2023 brice | ||
** Last update Thu Sep 20 11:23:54 AM 2023 brice | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <memory> | ||
#include <vector> | ||
#include "ISystem.hpp" | ||
#include "Registry.hpp" | ||
|
||
namespace System { | ||
class SystemManager { | ||
public: | ||
SystemManager(Registry ®is try); | ||
~SystemManager(); | ||
|
||
void updateSystems(); | ||
|
||
void addSystems(std::vector<std::unique_ptr<ISystem>> systems); | ||
|
||
protected: | ||
std::vector<std::unique_ptr<ISystem>> _systems; | ||
}; | ||
} |