Rename ChipmunkPhysics2D and JoltPhysics3D to Physics[2D|3D]
This commit is contained in:
40
include/Nazara/Physics2D/Components/RigidBody2DComponent.hpp
Normal file
40
include/Nazara/Physics2D/Components/RigidBody2DComponent.hpp
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics2D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_PHYSICS2D_COMPONENTS_RIGIDBODY2DCOMPONENT_HPP
|
||||
#define NAZARA_PHYSICS2D_COMPONENTS_RIGIDBODY2DCOMPONENT_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Physics2D/RigidBody2D.hpp>
|
||||
#include <variant>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_PHYSICS2D_API RigidBody2DComponent : public RigidBody2D
|
||||
{
|
||||
friend class Physics2DSystem;
|
||||
|
||||
public:
|
||||
inline RigidBody2DComponent(const RigidBody2D::DynamicSettings& settings);
|
||||
inline RigidBody2DComponent(const RigidBody2D::StaticSettings& settings);
|
||||
RigidBody2DComponent(const RigidBody2DComponent&) = delete;
|
||||
RigidBody2DComponent(RigidBody2DComponent&&) noexcept = default;
|
||||
~RigidBody2DComponent() = default;
|
||||
|
||||
RigidBody2DComponent& operator=(const RigidBody2DComponent&) = delete;
|
||||
RigidBody2DComponent& operator=(RigidBody2DComponent&&) noexcept = default;
|
||||
|
||||
private:
|
||||
inline void Construct(PhysWorld2D& world);
|
||||
|
||||
using Setting = std::variant<RigidBody2D::DynamicSettings, RigidBody2D::StaticSettings>;
|
||||
std::unique_ptr<Setting> m_settings;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Physics2D/Components/RigidBody2DComponent.inl>
|
||||
|
||||
#endif // NAZARA_PHYSICS2D_COMPONENTS_RIGIDBODY2DCOMPONENT_HPP
|
||||
30
include/Nazara/Physics2D/Components/RigidBody2DComponent.inl
Normal file
30
include/Nazara/Physics2D/Components/RigidBody2DComponent.inl
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Physics2D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics2D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline RigidBody2DComponent::RigidBody2DComponent(const RigidBody2D::DynamicSettings& settings)
|
||||
{
|
||||
m_settings = std::make_unique<Setting>(settings);
|
||||
}
|
||||
|
||||
inline RigidBody2DComponent::RigidBody2DComponent(const RigidBody2D::StaticSettings& settings)
|
||||
{
|
||||
m_settings = std::make_unique<Setting>(settings);
|
||||
}
|
||||
|
||||
inline void RigidBody2DComponent::Construct(PhysWorld2D& world)
|
||||
{
|
||||
assert(m_settings);
|
||||
std::visit([&](auto&& arg)
|
||||
{
|
||||
Create(world, arg);
|
||||
}, *m_settings);
|
||||
m_settings.reset();
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Physics2D/DebugOff.hpp>
|
||||
Reference in New Issue
Block a user