dummy physics system

This commit is contained in:
2019-12-04 22:39:02 +07:00
parent 36cb725cc1
commit ca327c950d
5 changed files with 74 additions and 0 deletions

View File

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

View File

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

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 physics_system final
: public ecs::system<ecs::after<systems::update_event>> {
public:
physics_system();
~physics_system() noexcept final;
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

@@ -33,6 +33,7 @@
#include <enduro2d/high/systems/flipbook_system.hpp>
#include <enduro2d/high/systems/input_system.hpp>
#include <enduro2d/high/systems/label_system.hpp>
#include <enduro2d/high/systems/physics_system.hpp>
#include <enduro2d/high/systems/render_system.hpp>
#include <enduro2d/high/systems/script_system.hpp>
#include <enduro2d/high/systems/spine_system.hpp>
@@ -61,6 +62,8 @@ namespace
.add_system<input_system>())
.feature<struct label_feature>(ecs::feature()
.add_system<label_system>())
.feature<struct physics_feature>(ecs::feature()
.add_system<physics_system>())
.feature<struct render_feature>(ecs::feature()
.add_system<render_system>())
.feature<struct sript_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/physics_system.hpp>
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<systems::update_event>& trigger)
{
state_->process(trigger.event.dt, owner);
}
}