Leviathan  0.8.0.0
Leviathan game engine
Leviathan::Physics::ApplyForceInfo Class Reference

Holder for information regarding a single force. More...

#include <Components.h>

Public Member Functions

 ApplyForceInfo (bool addmass, std::function< Float3(ApplyForceInfo *instance, Physics &object)> getforce, std::unique_ptr< std::string > name=nullptr)
 
 ApplyForceInfo (const ApplyForceInfo &other)
 
 ApplyForceInfo (ApplyForceInfo &&other)
 
ApplyForceInfooperator= (const ApplyForceInfo &other)
 

Public Attributes

std::unique_ptr< std::string > OptionalName
 Set a name when you don't want other non-named forces to override this. More...
 
bool MultiplyByMass
 
std::function< Float3(ApplyForceInfo *instance, Physics &object)> Callback
 

Detailed Description

Holder for information regarding a single force.

Definition at line 350 of file Components.h.

Constructor & Destructor Documentation

◆ ApplyForceInfo() [1/3]

Leviathan::Physics::ApplyForceInfo::ApplyForceInfo ( bool  addmass,
std::function< Float3(ApplyForceInfo *instance, Physics &object)>  getforce,
std::unique_ptr< std::string >  name = nullptr 
)
inline
Note
Pass NULL for name if not used, avoid passing empty strings
Parameters
nameThe name to assign. This will be deleted by a std::unique_ptr

Definition at line 354 of file Components.h.

356  :
357  OptionalName(move(name)),
358  MultiplyByMass(addmass), Callback(getforce)
359  {}
std::function< Float3(ApplyForceInfo *instance, Physics &object)> Callback
Definition: Components.h:394
std::unique_ptr< std::string > OptionalName
Set a name when you don't want other non-named forces to override this.
Definition: Components.h:386

◆ ApplyForceInfo() [2/3]

Leviathan::Physics::ApplyForceInfo::ApplyForceInfo ( const ApplyForceInfo other)
inline

Definition at line 361 of file Components.h.

361  :
362  MultiplyByMass(other.MultiplyByMass), Callback(other.Callback)
363  {
364  if(other.OptionalName)
365  OptionalName = std::make_unique<std::string>(*other.OptionalName);
366  }
std::function< Float3(ApplyForceInfo *instance, Physics &object)> Callback
Definition: Components.h:394
std::unique_ptr< std::string > OptionalName
Set a name when you don't want other non-named forces to override this.
Definition: Components.h:386

◆ ApplyForceInfo() [3/3]

Leviathan::Physics::ApplyForceInfo::ApplyForceInfo ( ApplyForceInfo &&  other)
inline

Definition at line 368 of file Components.h.

368  :
369  OptionalName(move(other.OptionalName)),
370  MultiplyByMass(std::move(other.MultiplyByMass)), Callback(move(other.Callback))
371  {}
std::function< Float3(ApplyForceInfo *instance, Physics &object)> Callback
Definition: Components.h:394
std::unique_ptr< std::string > OptionalName
Set a name when you don't want other non-named forces to override this.
Definition: Components.h:386

Member Function Documentation

◆ operator=()

ApplyForceInfo& Leviathan::Physics::ApplyForceInfo::operator= ( const ApplyForceInfo other)
inline

Definition at line 373 of file Components.h.

374  {
375 
376  if(other.OptionalName)
377  OptionalName = std::make_unique<std::string>(*other.OptionalName);
378 
379  MultiplyByMass = other.MultiplyByMass;
380  Callback = other.Callback;
381 
382  return *this;
383  }
std::function< Float3(ApplyForceInfo *instance, Physics &object)> Callback
Definition: Components.h:394
std::unique_ptr< std::string > OptionalName
Set a name when you don't want other non-named forces to override this.
Definition: Components.h:386

Member Data Documentation

◆ Callback

std::function<Float3(ApplyForceInfo* instance, Physics& object)> Leviathan::Physics::ApplyForceInfo::Callback

The callback which returns the force

Todo:
Allow deleting this force from the callback

Definition at line 394 of file Components.h.

◆ MultiplyByMass

bool Leviathan::Physics::ApplyForceInfo::MultiplyByMass

Whether to multiply the force by mass, makes acceleration constant with different masses

Definition at line 390 of file Components.h.

◆ OptionalName

std::unique_ptr<std::string> Leviathan::Physics::ApplyForceInfo::OptionalName

Set a name when you don't want other non-named forces to override this.

Definition at line 386 of file Components.h.


The documentation for this class was generated from the following file: