diff --git a/headers/enduro2d/high/_all.hpp b/headers/enduro2d/high/_all.hpp index 266215ca..959ec2b4 100644 --- a/headers/enduro2d/high/_all.hpp +++ b/headers/enduro2d/high/_all.hpp @@ -43,6 +43,7 @@ #include "components/spine_player.hpp" #include "components/sprite_renderer.hpp" +#include "systems/camera_system.hpp" #include "systems/flipbook_system.hpp" #include "systems/frame_system.hpp" #include "systems/gizmos_system.hpp" diff --git a/headers/enduro2d/high/_high.hpp b/headers/enduro2d/high/_high.hpp index 2120dc51..1a118740 100644 --- a/headers/enduro2d/high/_high.hpp +++ b/headers/enduro2d/high/_high.hpp @@ -61,6 +61,7 @@ namespace e2d class spine_player; class sprite_renderer; + class camera_system; class flipbook_system; class frame_system; class gizmos_system; diff --git a/headers/enduro2d/high/systems/camera_system.hpp b/headers/enduro2d/high/systems/camera_system.hpp new file mode 100644 index 00000000..7a1cb89a --- /dev/null +++ b/headers/enduro2d/high/systems/camera_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 camera_system final + : public ecs::system> { + public: + camera_system(); + ~camera_system() noexcept; + + 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 c6fe3f76..725f7c35 100644 --- a/sources/enduro2d/high/starter.cpp +++ b/sources/enduro2d/high/starter.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -55,6 +56,8 @@ namespace bool initialize() final { ecs::registry_filler(the().registry()) + .feature(ecs::feature() + .add_system()) .feature(ecs::feature() .add_system()) .feature(ecs::feature() diff --git a/sources/enduro2d/high/systems/camera_system.cpp b/sources/enduro2d/high/systems/camera_system.cpp new file mode 100644 index 00000000..f19bba19 --- /dev/null +++ b/sources/enduro2d/high/systems/camera_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 + +#include + +namespace e2d +{ + // + // camera_system::internal_state + // + + class camera_system::internal_state final : private noncopyable { + public: + internal_state() = default; + ~internal_state() noexcept = default; + + void process_update(ecs::registry& owner) { + E2D_UNUSED(owner); + } + }; + + // + // camera_system + // + + camera_system::camera_system() + : state_(new internal_state()) {} + camera_system::~camera_system() noexcept = default; + + void camera_system::process( + ecs::registry& owner, + const ecs::after& trigger) + { + E2D_UNUSED(trigger); + E2D_PROFILER_SCOPE("camera_system.process_update"); + state_->process_update(owner); + } +}