mirror of
https://github.com/Ragora/T2-CPP.git
synced 2026-02-21 23:53:39 +00:00
Added new Move Code
Added Move Code, TS callback, and commands to interface with Move code.
This commit is contained in:
parent
2ee8c36a90
commit
81a28fe3ba
7 changed files with 212 additions and 3 deletions
55
CommonAPI/Common/source/DXAPI/Move.cpp
Normal file
55
CommonAPI/Common/source/DXAPI/Move.cpp
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#include <DXAPI/Move.h>
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define M_2PI 6.28318530717958647692528676655900576
|
||||
namespace DX
|
||||
{
|
||||
void generateNullMove(Move * ret) {
|
||||
DX::Move nullmove = {
|
||||
16,
|
||||
16,
|
||||
16,
|
||||
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
||||
0,
|
||||
0,
|
||||
false,false,false,false,false,false
|
||||
|
||||
|
||||
};
|
||||
ret = &nullmove;
|
||||
}
|
||||
float clamp(float in, float min, float max) {
|
||||
if (in < min) {
|
||||
return min;
|
||||
} else if (in > max) {
|
||||
return max;
|
||||
}
|
||||
return in;
|
||||
}
|
||||
float clip(float n, float lower, float upper) {
|
||||
return std::max(lower, std::min(n, upper));
|
||||
}
|
||||
float clampFloat(float in){
|
||||
return clip(in,-1.0f,1.0f);
|
||||
}
|
||||
|
||||
float clampMove(float in) {
|
||||
float tmpfloat = clamp(in,-M_PI,M_PI);
|
||||
if (tmpfloat < 0.0) {
|
||||
return tmpfloat + M_2PI;
|
||||
} else {
|
||||
return tmpfloat;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue