diff --git a/CMakeLists.txt b/CMakeLists.txt index c46eec1..e3458f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ project( file(GLOB_RECURSE SRC_FILES src/*.cpp) add_executable(app ${SRC_FILES}) -target_include_directories(app PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include/conductor) +target_include_directories(app PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) find_package(SFML 2 REQUIRED network audio graphics window system) target_include_directories(app PUBLIC ${SFML_INCLUDE_DIR}) target_link_libraries(app sfml-graphics) diff --git a/include/conductor/Conductor.h b/include/conductor/Conductor.h index 870cb54..f6885a2 100644 --- a/include/conductor/Conductor.h +++ b/include/conductor/Conductor.h @@ -2,11 +2,11 @@ #define DEF_CONDUCTOR #include -#include "ControllerHandler.h" -#include "ScheduleHandler.h" -#include "PhysicsHandler.h" -#include "DrawHandler.h" -#include "AudioHandler.h" +#include "conductor/ControllerHandler.h" +#include "conductor/ScheduleHandler.h" +#include "conductor/PhysicsHandler.h" +#include "conductor/DrawHandler.h" +#include "conductor/AudioHandler.h" class Conductor { public: diff --git a/include/entity/strategies/strategy.h b/include/entity/strategies/strategy.h index 8867b99..5cce64b 100644 --- a/include/entity/strategies/strategy.h +++ b/include/entity/strategies/strategy.h @@ -1,7 +1,7 @@ #ifndef STRATEGY_H #define STRATEGY_H -virtual class Strategy +class Strategy //For now Strategy seems only a polymorphic-class, usefull only to store every strategies. //we'll have to think how we want to use strategies, because if they're all stored as Strategy //we can't write strategies.get(0).aMethodFromPhysicalEntity() because strategies.get(0) is of type Strategy, @@ -25,4 +25,4 @@ Strategy::~Strategy() } -#endif \ No newline at end of file +#endif diff --git a/include/phx/phx.h b/include/phx/phx.h index d38ae9f..dfaa647 100644 --- a/include/phx/phx.h +++ b/include/phx/phx.h @@ -1,41 +1,19 @@ #ifndef PHX_PHX_H #define PHX_PHX_H -#include +#include "lib/lib.h" #include +#include +#include "entity/strategies/physical_entity.h" // Constrain // vitessePersoMax < longeurPersoMin -// dependencies -class Scene; -class Entity; - -typedef std::pair Vec; -typedef std::pair Vel; - -/** - * Update each Entity in the Scene - */ -void update(Scene); - -void updateCinematics(Entity&); -void updateCollision(Scene); - -class Cinematics { -private: - Vec m_pos; - Vel m_vel; -}; +Vel updateCinematics(PhysicalEntity const); class Hitbox { private: std::vector m_vertices; }; -class PhysicalParameters { -private: - std::vector m_parameters; -}; - #endif diff --git a/src/main.cpp b/src/main.cppp similarity index 95% rename from src/main.cpp rename to src/main.cppp index 8be6250..e4bd9c4 100644 --- a/src/main.cpp +++ b/src/main.cppp @@ -3,7 +3,7 @@ using namespace std; #include -#include "Conductor.h" +#include "conductor/Conductor.h" int main(){ diff --git a/src/phx/README.md b/src/phx/README.md new file mode 100644 index 0000000..a1e6fb0 --- /dev/null +++ b/src/phx/README.md @@ -0,0 +1,7 @@ +#PHX + +- Use unsigned int from 0 to MAX_INT to calculate the physics +- Positions are unsigned int pairs, Vectors are signed int pairs. These types are declared in lib. +- updateCinematics act like the pfd. Do not take into account collisions. + Param: PhysicalEntity + Output: correction velocity to apply diff --git a/src/phx/phx.cpp b/src/phx/phx.cpp new file mode 100644 index 0000000..9fdbbee --- /dev/null +++ b/src/phx/phx.cpp @@ -0,0 +1,22 @@ +#include "phx/phx.h" +#include + +Vel updateCinematics(PhysicalEntity const ett) { + Vel correction (0,0); + Vel ett.getVelocity(); + std::vector forces = ett.getForce(); + + for (auto force: forces) { + switch(force) { + case weight: + correction.second += -10; + break; + + default: + break; + } + } + + return correction; +} +