Utility: Add velocity component and system
This commit is contained in:
38
include/Nazara/Utility/Components/VelocityComponent.hpp
Normal file
38
include/Nazara/Utility/Components/VelocityComponent.hpp
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_UTILITY_COMPONENTS_VELOCITYCOMPONENT_HPP
|
||||
#define NAZARA_UTILITY_COMPONENTS_VELOCITYCOMPONENT_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_UTILITY_API VelocityComponent
|
||||
{
|
||||
public:
|
||||
inline VelocityComponent(const Vector3f& linearVelocity = Vector3f::Zero());
|
||||
VelocityComponent(const VelocityComponent&) = default;
|
||||
VelocityComponent(VelocityComponent&&) = default;
|
||||
~VelocityComponent() = default;
|
||||
|
||||
inline const Vector3f& GetLinearVelocity() const;
|
||||
|
||||
inline void UpdateLinearVelocity(const Vector3f& linearVelocity);
|
||||
|
||||
VelocityComponent& operator=(const VelocityComponent&) = default;
|
||||
VelocityComponent& operator=(VelocityComponent&&) = default;
|
||||
|
||||
private:
|
||||
Vector3f m_linearVelocity;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Utility/Components/VelocityComponent.inl>
|
||||
|
||||
#endif // NAZARA_UTILITY_COMPONENTS_VELOCITYCOMPONENT_HPP
|
||||
26
include/Nazara/Utility/Components/VelocityComponent.inl
Normal file
26
include/Nazara/Utility/Components/VelocityComponent.inl
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Utility/Components/VelocityComponent.hpp>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline VelocityComponent::VelocityComponent(const Vector3f& linearVelocity) :
|
||||
m_linearVelocity(linearVelocity)
|
||||
{
|
||||
}
|
||||
|
||||
inline const Vector3f& VelocityComponent::GetLinearVelocity() const
|
||||
{
|
||||
return m_linearVelocity;
|
||||
}
|
||||
|
||||
inline void VelocityComponent::UpdateLinearVelocity(const Vector3f& linearVelocity)
|
||||
{
|
||||
m_linearVelocity = linearVelocity;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Utility/DebugOff.hpp>
|
||||
Reference in New Issue
Block a user