143 lines
4.1 KiBLFS
C++
143 lines
4.1 KiBLFS
C++
/**
|
|
* @file
|
|
*
|
|
* @author Max Lammers <max@senseglove.com>
|
|
* @author Mamadou Babaei <mamadou@senseglove.com>
|
|
*
|
|
* @section LICENSE
|
|
*
|
|
* Copyright (c) 2020 - 2023 SenseGlove
|
|
*
|
|
* @section DESCRIPTION
|
|
*
|
|
*
|
|
*/
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
#include "Platform.hpp"
|
|
|
|
namespace SGCore
|
|
{
|
|
namespace Haptics
|
|
{
|
|
class SGCORE_API TimedThumpCommand;
|
|
|
|
class ThumperCommand;
|
|
}// namespace Haptics
|
|
}// namespace SGCore
|
|
|
|
class SGCORE_API SGCore::Haptics::TimedThumpCommand
|
|
{
|
|
private:
|
|
struct Impl;
|
|
std::unique_ptr<Impl> Pimpl;
|
|
|
|
#if SENSEGLOVE_UNREAL_ENGINE_PLUGIN
|
|
public:
|
|
#else /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */
|
|
protected:
|
|
#endif /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */
|
|
/// <summary> Internal, empty, for extended classes. </summary>
|
|
TimedThumpCommand();
|
|
|
|
public:
|
|
/// <summary> Create a new Timed Thumper Command. </summary>
|
|
/// <param name="magnitude">Value between 0 .. 1 representing the magnitude of the system.</param>
|
|
/// <param name="durationSeconds"></param>
|
|
/// <param name="startTimeSeconds"></param>
|
|
TimedThumpCommand(int32_t magnitude, float durationSeconds, float startTimeSeconds = 0.0f);
|
|
|
|
/// <summary> Create a new Timed Thumper Command. </summary>
|
|
/// <param name="baseCommand"></param>
|
|
/// <param name="durationSeconds"></param>
|
|
/// <param name="startTimeSeconds"></param>
|
|
TimedThumpCommand(const ThumperCommand& baseCommand, float durationSeconds, float startTimeSeconds = 0.0f);
|
|
|
|
/**
|
|
* The copy constructor.
|
|
*/
|
|
TimedThumpCommand(const TimedThumpCommand& rhs);
|
|
|
|
/**
|
|
* The move constructor.
|
|
*/
|
|
TimedThumpCommand(TimedThumpCommand&& rhs) noexcept;
|
|
|
|
/// <summary> The basic destructor. </summary>
|
|
virtual ~TimedThumpCommand();
|
|
|
|
public:
|
|
/**
|
|
* The copy assignment operator.
|
|
*/
|
|
TimedThumpCommand& operator=(const TimedThumpCommand& rhs);
|
|
|
|
/**
|
|
* The move assignment operator.
|
|
*/
|
|
TimedThumpCommand& operator=(TimedThumpCommand&& rhs) noexcept;
|
|
|
|
public:
|
|
/// <summary> Magnitude in %. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
int32_t GetMagnitude() const;
|
|
|
|
#if SENSEGLOVE_UNREAL_ENGINE_PLUGIN
|
|
void SetMagnitude(int32_t magnitude);
|
|
#endif /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */
|
|
|
|
/// <summary> Duration in seconds. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
float GetDuration() const;
|
|
|
|
#if SENSEGLOVE_UNREAL_ENGINE_PLUGIN
|
|
void SetDuration(float duration);
|
|
#endif /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */
|
|
|
|
/// <summary> The elapsed time so far. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
float GetElapsedTime() const;
|
|
|
|
#if SENSEGLOVE_UNREAL_ENGINE_PLUGIN
|
|
void SetElapsedTime(float elapsedTime);
|
|
#endif /* SENSEGLOVE_UNREAL_ENGINE_PLUGIN */
|
|
|
|
/// <summary> Returns true if the timed command has elapsed. </summary>
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
bool HasTimeElapsed() const;
|
|
|
|
public:
|
|
/// <summary> Copy the parameters of this ThumperCommand into another instance. </summary>
|
|
/// <returns></returns>
|
|
virtual TimedThumpCommand Copy(bool bCopyElapsed = true) const;
|
|
|
|
/// <summary> Update the timing on this Thumper Command. </summary>
|
|
/// <param name="deltaSeconds"></param>
|
|
virtual void Update(float deltaSeconds);
|
|
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
virtual bool Equals(const ThumperCommand& command) const;
|
|
|
|
public:
|
|
#if !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN )
|
|
[[nodiscard]]
|
|
#endif /* !defined ( SENSEGLOVE_UNREAL_ENGINE_PLUGIN ) */
|
|
std::string ToString() const;
|
|
};
|