From ca327c950dd82ba5ef1ee035b40a42d03f9abbec Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Wed, 4 Dec 2019 22:39:02 +0700 Subject: [PATCH] dummy physics system --- headers/enduro2d/high/_all.hpp | 1 + headers/enduro2d/high/_high.hpp | 1 + .../enduro2d/high/systems/physics_system.hpp | 26 +++++++++++ sources/enduro2d/high/starter.cpp | 3 ++ .../enduro2d/high/systems/physics_system.cpp | 43 +++++++++++++++++++ 5 files changed, 74 insertions(+) create mode 100644 headers/enduro2d/high/systems/physics_system.hpp create mode 100644 sources/enduro2d/high/systems/physics_system.cpp diff --git a/headers/enduro2d/high/_all.hpp b/headers/enduro2d/high/_all.hpp index f83d7315..4db05a3f 100644 --- a/headers/enduro2d/high/_all.hpp +++ b/headers/enduro2d/high/_all.hpp @@ -49,6 +49,7 @@ #include "systems/flipbook_system.hpp" #include "systems/input_system.hpp" #include "systems/label_system.hpp" +#include "systems/physics_system.hpp" #include "systems/render_system.hpp" #include "systems/script_system.hpp" #include "systems/spine_system.hpp" diff --git a/headers/enduro2d/high/_high.hpp b/headers/enduro2d/high/_high.hpp index ee56ce97..625668a0 100644 --- a/headers/enduro2d/high/_high.hpp +++ b/headers/enduro2d/high/_high.hpp @@ -69,6 +69,7 @@ namespace e2d class flipbook_system; class input_system; class label_system; + class physics_system; class render_system; class script_system; class spine_system; diff --git a/headers/enduro2d/high/systems/physics_system.hpp b/headers/enduro2d/high/systems/physics_system.hpp new file mode 100644 index 00000000..eda2a797 --- /dev/null +++ b/headers/enduro2d/high/systems/physics_system.hpp @@ -0,0 +1,26 @@ +/******************************************************************************* + * This file is part of the "Enduro2D" + * For conditions of distribution and use, see copyright notice in LICENSE.md + * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) + ******************************************************************************/ + +#pragma once + +#include "_systems.hpp" + +namespace e2d +{ + class physics_system final + : public ecs::system> { + public: + physics_system(); + ~physics_system() noexcept final; + + void process( + ecs::registry& owner, + const ecs::after& trigger) override; + private: + class internal_state; + std::unique_ptr state_; + }; +} diff --git a/sources/enduro2d/high/starter.cpp b/sources/enduro2d/high/starter.cpp index 5654b2b5..00dc6fbc 100644 --- a/sources/enduro2d/high/starter.cpp +++ b/sources/enduro2d/high/starter.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -61,6 +62,8 @@ namespace .add_system()) .feature(ecs::feature() .add_system()) + .feature(ecs::feature() + .add_system()) .feature(ecs::feature() .add_system()) .feature(ecs::feature() diff --git a/sources/enduro2d/high/systems/physics_system.cpp b/sources/enduro2d/high/systems/physics_system.cpp new file mode 100644 index 00000000..d3733009 --- /dev/null +++ b/sources/enduro2d/high/systems/physics_system.cpp @@ -0,0 +1,43 @@ +/******************************************************************************* + * This file is part of the "Enduro2D" + * For conditions of distribution and use, see copyright notice in LICENSE.md + * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) + ******************************************************************************/ + +#include + +namespace +{ + using namespace e2d; +} + +namespace e2d +{ + // + // physics_system::internal_state + // + + class physics_system::internal_state final : private noncopyable { + public: + internal_state() = default; + ~internal_state() noexcept = default; + + void process(f32 dt, ecs::registry& owner) { + } + }; + + // + // physics_system + // + + physics_system::physics_system() + : state_(new internal_state()) {} + physics_system::~physics_system() noexcept = default; + + void physics_system::process( + ecs::registry& owner, + const ecs::after& trigger) + { + state_->process(trigger.event.dt, owner); + } +}