Skip to content

Commit

Permalink
refactor: move Cubos to core
Browse files Browse the repository at this point in the history
  • Loading branch information
RiscadoA committed Jan 29, 2024
1 parent c7d9aeb commit 96bc851
Show file tree
Hide file tree
Showing 40 changed files with 67 additions and 52 deletions.
1 change: 1 addition & 0 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ set(CUBOS_CORE_SOURCE
"src/cubos/core/ecs/world.cpp"
"src/cubos/core/ecs/command_buffer.cpp"
"src/cubos/core/ecs/types.cpp"
"src/cubos/core/ecs/cubos.cpp"

"src/cubos/core/geom/box.cpp"
"src/cubos/core/geom/capsule.cpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@
#include <cubos/core/ecs/system/system.hpp>
#include <cubos/core/ecs/world.hpp>

#include <cubos/engine/prelude.hpp>

namespace cubos::engine
namespace cubos::core::ecs
{
/// @brief Resource which stores the time since the last iteration of the main loop started.
///
/// This resource is added and updated by the @ref Cubos class.
///
/// @ingroup engine
/// @ingroup core-ecs
struct DeltaTime
{
DeltaTime(float value);
Expand All @@ -32,7 +30,7 @@ namespace cubos::engine
///
/// This resource is added by the @ref Cubos class, initially set to true.
///
/// @ingroup engine
/// @ingroup core-ecs
struct ShouldQuit
{
ShouldQuit(bool value);
Expand All @@ -44,7 +42,7 @@ namespace cubos::engine
///
/// This resource is added by the @ref Cubos class.
///
/// @ingroup engine
/// @ingroup core-ecs
struct Arguments
{
Arguments(std::vector<std::string> value);
Expand All @@ -53,7 +51,7 @@ namespace cubos::engine
};

/// @brief Used to chain configurations related to tags.
/// @ingroup engine
/// @ingroup core-ecs
class TagBuilder
{
public:
Expand Down Expand Up @@ -87,7 +85,7 @@ namespace cubos::engine
};

/// @brief Used to chain configurations related to systems
/// @ingroup engine
/// @ingroup core-ecs
class SystemBuilder
{
public:
Expand Down Expand Up @@ -126,7 +124,7 @@ namespace cubos::engine

/// @brief Represents the engine itself, and exposes the interface with which the game
/// developer interacts with. Ties up all the different parts of the engine together.
/// @ingroup engine
/// @ingroup core-ecs
class Cubos final
{
public:
Expand Down Expand Up @@ -269,4 +267,4 @@ namespace cubos::engine
mStartupDispatcher.addSystem(func);
return {mStartupDispatcher, mMainTags};
}
} // namespace cubos::engine
} // namespace cubos::core::ecs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#include <utility>

#include <cubos/core/ecs/command_buffer.hpp>
#include <cubos/core/ecs/cubos.hpp>
#include <cubos/core/log.hpp>
#include <cubos/core/reflection/external/string.hpp>

#include <cubos/engine/cubos.hpp>

using namespace cubos::engine;
using cubos::core::ecs::Arguments;
using cubos::core::ecs::Cubos;
using cubos::core::ecs::DeltaTime;
using cubos::core::ecs::ShouldQuit;
using cubos::core::ecs::SystemBuilder;
using cubos::core::ecs::TagBuilder;

DeltaTime::DeltaTime(float value)
: value(value)
Expand Down
8 changes: 4 additions & 4 deletions docs/pages/2_features/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ An application which just prints `"Hello World!"` and which does absolutely
nothing else - not even open a window - would look like this:

```cpp
#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

#include <iostream>

using Cubos = cubos::engine::Cubos;
using cubos::engine::Cubos;

void helloWorld()
{
Expand Down Expand Up @@ -56,11 +56,11 @@ If we were to put the hello world functionality on a plugin, the previous
example would look like this:

```cpp
#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

#include <iostream>

using Cubos = cubos::engine::Cubos;
using cubos::engine::Cubos;

void helloWorld()
{
Expand Down
1 change: 0 additions & 1 deletion engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ message("# Building engine tests: " ${BUILD_ENGINE_TESTS})

# Set engine source files
set(CUBOS_ENGINE_SOURCE
"src/cubos/engine/cubos.cpp"
"src/cubos/engine/prelude.cpp"

"src/cubos/engine/settings/plugin.cpp"
Expand Down
2 changes: 1 addition & 1 deletion engine/include/cubos/engine/assets/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#pragma once

#include <cubos/engine/assets/assets.hpp>
#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

namespace cubos::engine
{
Expand Down
2 changes: 1 addition & 1 deletion engine/include/cubos/engine/collisions/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#pragma once

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

namespace cubos::engine
{
Expand Down
2 changes: 1 addition & 1 deletion engine/include/cubos/engine/gizmos/gizmos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include <cubos/core/gl/render_device.hpp>

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

namespace cubos::engine
{
Expand Down
2 changes: 1 addition & 1 deletion engine/include/cubos/engine/gizmos/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

#pragma once

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/gizmos/gizmos.hpp>
#include <cubos/engine/prelude.hpp>

namespace cubos::engine
{
Expand Down
2 changes: 1 addition & 1 deletion engine/include/cubos/engine/imgui/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#pragma once

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

namespace cubos::engine
{
Expand Down
2 changes: 1 addition & 1 deletion engine/include/cubos/engine/input/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#pragma once

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>
#include <cubos/engine/input/input.hpp>

namespace cubos::engine
Expand Down
2 changes: 1 addition & 1 deletion engine/include/cubos/engine/physics/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <cubos/core/reflection/external/glm.hpp>
#include <cubos/core/reflection/external/primitives.hpp>

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>
#include <cubos/engine/physics/components/accumulated_correction.hpp>
#include <cubos/engine/physics/components/physics_mass.hpp>
#include <cubos/engine/physics/components/physics_velocity.hpp>
Expand Down
2 changes: 1 addition & 1 deletion engine/include/cubos/engine/physics/plugins/gravity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>
#include <cubos/engine/physics/components/physics_mass.hpp>
#include <cubos/engine/physics/components/physics_velocity.hpp>
#include <cubos/engine/physics/resources/gravity.hpp>
Expand Down
13 changes: 13 additions & 0 deletions engine/include/cubos/engine/prelude.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <cubos/core/ecs/cubos.hpp>
#include <cubos/core/ecs/entity/entity.hpp>
#include <cubos/core/ecs/system/event/reader.hpp>
#include <cubos/core/ecs/system/event/writer.hpp>
Expand All @@ -8,6 +9,18 @@

namespace cubos::engine
{
/// @copydoc cubos::core::ecs::Cubos
using Cubos = core::ecs::Cubos;

/// @copydoc cubos::core::ecs::DeltaTime
using DeltaTime = core::ecs::DeltaTime;

/// @copydoc cubos::core::ecs::ShouldQuit
using ShouldQuit = core::ecs::ShouldQuit;

/// @copydoc cubos::core::ecs::Arguments
using Arguments = core::ecs::Arguments;

/// @copydoc cubos::core::ecs::Query
template <typename... ComponentTypes>
using Query = core::ecs::Query<ComponentTypes...>;
Expand Down
2 changes: 1 addition & 1 deletion engine/include/cubos/engine/scene/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#pragma once

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>
#include <cubos/engine/scene/scene.hpp>

namespace cubos::engine
Expand Down
2 changes: 1 addition & 1 deletion engine/include/cubos/engine/screen_picker/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#pragma once

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>
#include <cubos/engine/screen_picker/screen_picker.hpp>

namespace cubos::engine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <cubos/core/gl/render_device.hpp>

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

namespace cubos::engine
{
Expand Down
2 changes: 1 addition & 1 deletion engine/include/cubos/engine/settings/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#pragma once

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>
#include <cubos/engine/settings/settings.hpp>

namespace cubos::engine
Expand Down
2 changes: 1 addition & 1 deletion engine/include/cubos/engine/splitscreen/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#pragma once

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

namespace cubos::engine
{
Expand Down
2 changes: 1 addition & 1 deletion engine/include/cubos/engine/transform/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#pragma once

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>
#include <cubos/engine/transform/local_to_world.hpp>
#include <cubos/engine/transform/position.hpp>
#include <cubos/engine/transform/rotation.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <cubos/core/ecs/system/event/reader.hpp>

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>
#include <cubos/engine/input/input.hpp>
#include <cubos/engine/input/plugin.hpp>
#include <cubos/engine/transform/position.hpp>
Expand Down
2 changes: 1 addition & 1 deletion engine/include/cubos/engine/voxels/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#pragma once

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

namespace cubos::engine
{
Expand Down
2 changes: 1 addition & 1 deletion engine/include/cubos/engine/window/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <cubos/core/io/window.hpp>

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

namespace cubos::engine
{
Expand Down
2 changes: 1 addition & 1 deletion engine/samples/events/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <cubos/core/ecs/system/event/writer.hpp>
#include <cubos/core/reflection/external/primitives.hpp>

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

using namespace cubos::engine;

Expand Down
2 changes: 1 addition & 1 deletion engine/samples/gizmos/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>
#include <cubos/engine/gizmos/plugin.hpp>
#include <cubos/engine/renderer/plugin.hpp>
#include <cubos/engine/settings/settings.hpp>
Expand Down
2 changes: 1 addition & 1 deletion engine/samples/hello-cubos/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// [Include Components]

/// [Include]
#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

using cubos::engine::Cubos;
/// [Include]
Expand Down
2 changes: 1 addition & 1 deletion engine/samples/settings/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <cubos/core/reflection/external/string.hpp>

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>
#include <cubos/engine/settings/plugin.hpp>

using namespace cubos::engine;
Expand Down
2 changes: 1 addition & 1 deletion engine/src/cubos/engine/collisions/broad_phase/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#pragma once

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

namespace cubos::engine
{
Expand Down
2 changes: 1 addition & 1 deletion engine/src/cubos/engine/screen_picker/plugin.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <cubos/core/io/window.hpp>

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>
#include <cubos/engine/screen_picker/plugin.hpp>
#include <cubos/engine/screen_picker/screen_picker.hpp>
#include <cubos/engine/window/plugin.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#pragma once

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

namespace tesseratos
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#pragma once

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

namespace tesseratos
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <cubos/core/ecs/entity/entity.hpp>

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

namespace tesseratos
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#pragma once

#include <cubos/engine/cubos.hpp>
#include <cubos/engine/prelude.hpp>

namespace tesseratos
{
Expand Down
Loading

0 comments on commit 96bc851

Please sign in to comment.