(NDK) Added Velocity component/system
Former-commit-id: 427b7175fbf9723fcd1d54fc279b8b70167745d4
This commit is contained in:
33
SDK/include/NDK/Components/VelocityComponent.hpp
Normal file
33
SDK/include/NDK/Components/VelocityComponent.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2015 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Development Kit"
|
||||
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NDK_COMPONENTS_VELOCITYCOMPONENT_HPP
|
||||
#define NDK_COMPONENTS_VELOCITYCOMPONENT_HPP
|
||||
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <NDK/Component.hpp>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
class Entity;
|
||||
|
||||
class NDK_API VelocityComponent : public Component<VelocityComponent>
|
||||
{
|
||||
public:
|
||||
VelocityComponent(const NzVector3f& velocity = NzVector3f::Zero());
|
||||
~VelocityComponent() = default;
|
||||
|
||||
NzVector3f linearVelocity;
|
||||
|
||||
VelocityComponent& operator=(const NzVector3f& vel);
|
||||
|
||||
static ComponentIndex componentIndex;
|
||||
};
|
||||
}
|
||||
|
||||
#include <NDK/Components/VelocityComponent.inl>
|
||||
|
||||
#endif // NDK_COMPONENTS_VELOCITYCOMPONENT_HPP
|
||||
20
SDK/include/NDK/Components/VelocityComponent.inl
Normal file
20
SDK/include/NDK/Components/VelocityComponent.inl
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2015 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Development Kit"
|
||||
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
||||
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <NDK/Entity.hpp>
|
||||
|
||||
namespace Ndk
|
||||
{
|
||||
inline VelocityComponent::VelocityComponent(const NzVector3f& velocity) :
|
||||
linearVelocity(velocity)
|
||||
{
|
||||
}
|
||||
|
||||
inline VelocityComponent& VelocityComponent::operator=(const NzVector3f& vel)
|
||||
{
|
||||
linearVelocity = vel;
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user