From 6701dc2ec422b7be8fa2a94f5e7bcfc45b6f6bb7 Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Tue, 22 Oct 2019 03:20:20 +0700 Subject: [PATCH] add dummy script_system --- headers/enduro2d/high/_all.hpp | 1 + headers/enduro2d/high/_high.hpp | 1 + .../enduro2d/high/systems/script_system.hpp | 32 ++++++++++++ sources/enduro2d/high/starter.cpp | 3 ++ .../enduro2d/high/systems/script_system.cpp | 52 +++++++++++++++++++ 5 files changed, 89 insertions(+) create mode 100644 headers/enduro2d/high/systems/script_system.hpp create mode 100644 sources/enduro2d/high/systems/script_system.cpp diff --git a/headers/enduro2d/high/_all.hpp b/headers/enduro2d/high/_all.hpp index b6d015eb..b37ac2e7 100644 --- a/headers/enduro2d/high/_all.hpp +++ b/headers/enduro2d/high/_all.hpp @@ -44,6 +44,7 @@ #include "systems/flipbook_system.hpp" #include "systems/label_system.hpp" #include "systems/render_system.hpp" +#include "systems/script_system.hpp" #include "systems/spine_system.hpp" #include "address.hpp" diff --git a/headers/enduro2d/high/_high.hpp b/headers/enduro2d/high/_high.hpp index 050d40bd..a7e28c09 100644 --- a/headers/enduro2d/high/_high.hpp +++ b/headers/enduro2d/high/_high.hpp @@ -59,6 +59,7 @@ namespace e2d class flipbook_system; class label_system; class render_system; + class script_system; class spine_system; template < typename Asset, typename Content > diff --git a/headers/enduro2d/high/systems/script_system.hpp b/headers/enduro2d/high/systems/script_system.hpp new file mode 100644 index 00000000..ab080538 --- /dev/null +++ b/headers/enduro2d/high/systems/script_system.hpp @@ -0,0 +1,32 @@ +/******************************************************************************* + * 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 script_system final + : public ecs::system< + systems::update_event, + ecs::after> { + public: + script_system(); + ~script_system() noexcept; + + void process( + ecs::registry& owner, + const systems::update_event& event) override; + + void process( + ecs::registry& owner, + const ecs::after& event) override; + private: + class internal_state; + std::unique_ptr state_; + }; +} diff --git a/sources/enduro2d/high/starter.cpp b/sources/enduro2d/high/starter.cpp index 31b70f2f..0ffede87 100644 --- a/sources/enduro2d/high/starter.cpp +++ b/sources/enduro2d/high/starter.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include namespace @@ -53,6 +54,8 @@ namespace .add_system()) .feature(ecs::feature() .add_system()) + .feature(ecs::feature() + .add_system()) .feature(ecs::feature() .add_system()); return !application_ || application_->initialize(); diff --git a/sources/enduro2d/high/systems/script_system.cpp b/sources/enduro2d/high/systems/script_system.cpp new file mode 100644 index 00000000..fa6d635f --- /dev/null +++ b/sources/enduro2d/high/systems/script_system.cpp @@ -0,0 +1,52 @@ +/******************************************************************************* + * 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 e2d +{ + // + // script_system::internal_state + // + + class script_system::internal_state final : private noncopyable { + public: + internal_state() = default; + ~internal_state() noexcept = default; + + void update_process(ecs::registry& owner) { + E2D_UNUSED(owner); + } + + void finalize_process(ecs::registry& owner) { + E2D_UNUSED(owner); + } + }; + + // + // script_system + // + + script_system::script_system() + : state_(new internal_state()) {} + script_system::~script_system() noexcept = default; + + void script_system::process( + ecs::registry& owner, + const systems::update_event& event) + { + E2D_UNUSED(event); + state_->update_process(owner); + } + + void script_system::process( + ecs::registry& owner, + const ecs::after& event) + { + E2D_UNUSED(event); + state_->finalize_process(owner); + } +}