dummy camera system

This commit is contained in:
2020-01-28 20:02:29 +07:00
parent d7ab730d2a
commit c2e4978eed
5 changed files with 74 additions and 0 deletions

View File

@@ -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"

View File

@@ -61,6 +61,7 @@ namespace e2d
class spine_player;
class sprite_renderer;
class camera_system;
class flipbook_system;
class frame_system;
class gizmos_system;

View File

@@ -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<ecs::after<systems::update_event>> {
public:
camera_system();
~camera_system() noexcept;
void process(
ecs::registry& owner,
const ecs::after<systems::update_event>& trigger) override;
private:
class internal_state;
std::unique_ptr<internal_state> state_;
};
}

View File

@@ -28,6 +28,7 @@
#include <enduro2d/high/components/spine_player.hpp>
#include <enduro2d/high/components/sprite_renderer.hpp>
#include <enduro2d/high/systems/camera_system.hpp>
#include <enduro2d/high/systems/flipbook_system.hpp>
#include <enduro2d/high/systems/frame_system.hpp>
#include <enduro2d/high/systems/gizmos_system.hpp>
@@ -55,6 +56,8 @@ namespace
bool initialize() final {
ecs::registry_filler(the<world>().registry())
.feature<struct camera_feature>(ecs::feature()
.add_system<camera_system>())
.feature<struct flipbook_feature>(ecs::feature()
.add_system<flipbook_system>())
.feature<struct frame_feature>(ecs::feature()

View File

@@ -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 <enduro2d/high/systems/camera_system.hpp>
#include <enduro2d/high/components/camera.hpp>
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<systems::update_event>& trigger)
{
E2D_UNUSED(trigger);
E2D_PROFILER_SCOPE("camera_system.process_update");
state_->process_update(owner);
}
}