Skip to content

Commit

Permalink
feat(ecs): working on ecs module
Browse files Browse the repository at this point in the history
  • Loading branch information
Milerius committed Sep 11, 2019
1 parent aa7a499 commit 88cddb8
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 3 deletions.
7 changes: 6 additions & 1 deletion cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ FetchContent_Declare(
URL https://github.com/skypjack/entt/archive/master.zip
)

FetchContent_MakeAvailable(doctest entt)
FetchContent_Declare(
doom_st
URL https://github.com/doom/strong_type/archive/1.0.2.tar.gz
)

FetchContent_MakeAvailable(doctest entt doom_st)
2 changes: 1 addition & 1 deletion modules/ecs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
add_library(antara_ecs_shared_sources INTERFACE)
target_sources(antara_ecs_shared_sources INTERFACE antara/gaming/ecs/base.system.cpp)
target_include_directories(antara_ecs_shared_sources INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(antara_ecs_shared_sources INTERFACE EnTT)
target_link_libraries(antara_ecs_shared_sources INTERFACE EnTT strong_type)
add_library(antara::ecs_shared_sources ALIAS antara_ecs_shared_sources)


Expand Down
5 changes: 5 additions & 0 deletions modules/ecs/antara/gaming/ecs/antara.ecs.system.tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ TEST_CASE ("base system abstract object tests")

}

[[nodiscard]] antara::gaming::ecs::system_type get_system_type_RTTI() const noexcept final
{
return antara::gaming::ecs::system_type::logic_update;
}

void update() noexcept final
{
//!
Expand Down
4 changes: 3 additions & 1 deletion modules/ecs/antara/gaming/ecs/base.system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <entt/entity/registry.hpp>
#include <entt/signal/dispatcher.hpp>
#include "antara/gaming/ecs/base.system.hpp"
#include "antara/gaming/ecs/system.type.hpp"

namespace antara::gaming::ecs
{
Expand All @@ -33,6 +33,8 @@ namespace antara::gaming::ecs

//! Pure virtual functions
virtual void update() noexcept = 0;
[[nodiscard]] virtual system_type get_system_type_RTTI() const noexcept = 0;


/**
* \note This function marks the system, it will be destroyed in the next turn of the game loop by the system_manager.
Expand Down
34 changes: 34 additions & 0 deletions modules/ecs/antara/gaming/ecs/system.type.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/******************************************************************************
* Copyright © 2013-2019 The Komodo Platform Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* Komodo Platform software, including this file may be copied, modified, *
* propagated or distributed except according to the terms contained in the *
* LICENSE file *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/

#pragma once

#include <st/st.hpp>

namespace antara::gaming::ecs
{
enum system_type
{
pre_update,
logic_update,
post_update,
size
};

using st_system_pre_update = st::type<system_type, struct system_pre_update_tag>;
using st_system_logic_update = st::type<system_type, struct system_logic_update_tag>;
using st_system_post_update = st::type<system_type, struct system_post_update_tag>;
}

0 comments on commit 88cddb8

Please sign in to comment.