This commit is contained in:
Michael Fabain Dirks
2016-05-08 22:47:15 +02:00
parent 2b82733b4b
commit e77dfd17eb
42 changed files with 5660 additions and 5560 deletions
+373 -373
View File
@@ -1,374 +1,374 @@
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Project Kube (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
#include "Vector3.h"
void Vector3::set(const float &o)
{
this->X = o;
this->Y = o;
this->Z = o;
}
void Vector3::set(const float &x, const float &y, const float &z)
{
this->X = x;
this->Y = y;
this->Z = z;
}
void Vector3::set(const Vector3 &o)
{
if (this != &o) {
this->X = o.X;
this->Y = o.Y;
this->Z = o.Z;
}
}
void Vector3::add(const float &o)
{
this->X += o;
this->Y += o;
this->Z += o;
}
void Vector3::add(const float &x, const float &y, const float &z)
{
this->X += x;
this->Y += y;
this->Z += z;
}
void Vector3::add(const Vector3 &o)
{
this->X += o.X;
this->Y += o.Y;
this->Z += o.Z;
}
void Vector3::sub(const float &o)
{
this->X -= o;
this->Y -= o;
this->Z -= o;
}
void Vector3::sub(const float &x, const float &y, const float &z)
{
this->X -= x;
this->Y -= y;
this->Z -= z;
}
void Vector3::sub(const Vector3 &o)
{
this->X -= o.X;
this->Y -= o.Y;
this->Z -= o.Z;
}
void Vector3::mul(const float &o)
{
this->X *= o;
this->Y *= o;
this->Z *= o;
}
void Vector3::mul(const float &x, const float &y, const float &z)
{
this->X *= x;
this->Y *= y;
this->Z *= z;
}
void Vector3::mul(const Vector3 &o)
{
this->X *= o.X;
this->Y *= o.Y;
this->Z *= o.Z;
}
void Vector3::div(const float &o)
{
this->X /= o;
this->Y /= o;
this->Z /= o;
}
void Vector3::div(const float &x, const float &y, const float &z)
{
this->X /= x;
this->Y /= y;
this->Z /= z;
}
void Vector3::div(const Vector3 &o)
{
this->X /= o.X;
this->Y /= o.Y;
this->Z /= o.Z;
}
float Vector3::length()
{
return sqrt(this->X * this->X + this->Y * this->Y + this->Z * this->Z);
}
float Vector3::distance(const float &x, const float &y, const float &z)
{
float X = (this->X - x);
float Y = (this->Y - y);
float Z = (this->Z - z);
return sqrt(X * X + Y * Y + Z * Z);
}
float Vector3::distance(const Vector3 &o)
{
float X = (this->X - o.X);
float Y = (this->Y - o.Y);
float Z = (this->Z - o.Z);
return sqrt(X * X + Y * Y + Z * Z);
}
float Vector3::dot(const float &x, const float &y, const float &z)
{
return (this->X * x) + (this->Y * y) + (this->Z * z);
}
float Vector3::dot(const Vector3 &o)
{
return (this->X * o.X) + (this->Y * o.Y) + (this->Z * o.Z);
}
Vector3 Vector3::cross(const float &x, const float &y, const float &z)
{
Vector3* data = new Vector3();
data->X = (this->Y * z) - (this->Z * y);
data->Y = (this->Z * x) - (this->X * z);
data->Z = (this->X * y) - (this->Y * x);
return *data;
}
Vector3 Vector3::cross(const Vector3 &o)
{
Vector3* data = new Vector3();
data->X = (this->Y * o.Z) - (this->Z * o.Y);
data->Y = (this->Z * o.X) - (this->X * o.Z);
data->Z = (this->X * o.Y) - (this->Y * o.X);
return *data;
}
void Vector3::normalize()
{
this->div(this->length());
}
void Vector3::rotate(float &pitch, float &yaw, float &roll)
{
float** matrix = new float*[3];
matrix[0] = new float[3]; matrix[1] = new float[3]; matrix[2] = new float[3];
matrix[0][0] = cos(yaw) * cos(roll); matrix[0][1] = -sin(roll); matrix[0][2] = sin(yaw);
matrix[1][0] = sin(roll); matrix[1][1] = cos(pitch) * cos(roll); matrix[1][2] = -sin(pitch);
matrix[2][0] = -sin(yaw); matrix[2][1] = sin(pitch); matrix[2][2] = cos(pitch) * cos(yaw);
float X = (this->X * matrix[0][0]) + (this->Y * matrix[0][1]) + (this->Z * matrix[0][2]);
float Y = (this->X * matrix[1][0]) + (this->Y * matrix[1][1]) + (this->Z * matrix[1][2]);
float Z = (this->X * matrix[2][0]) + (this->Y * matrix[2][1]) + (this->Z * matrix[2][2]);
this->X = X; this->Y = Y; this->Z = Z;
}
void Vector3::rotateAround(const float &x, const float &y, const float &z, float &pitch, float &yaw, float &roll)
{
this->sub(x, y, z);
this->rotate(pitch, yaw, roll);
this->add(x, y, z);
}
void Vector3::rotateAround(Vector3 &o, float &pitch, float &yaw, float &roll)
{
this->sub(o);
this->rotate(pitch, yaw, roll);
this->add(o);
}
float Vector3::deltaPitch() {
return (float)(atan(this->X / -this->Y) * (180.0 / M_PI));
}
float Vector3::deltaPitch(const float &x, const float &y, const float &z)
{
return (float)(atan((this->X - x) / (-(this->Y - y))) * (180.0 / M_PI));
}
float Vector3::deltaPitch(Vector3 &o)
{
return (float)(atan((this->X - o.X) / (-(this->Y - o.Y))) * (180.0 / M_PI));
}
float Vector3::deltaYaw() {
return (float)(atan(sqrt((this->X * this->X) + (this->Y * this->Y)) / this->Z) * (180.0 / M_PI));
}
float Vector3::deltaYaw(const float &x, const float &y, const float &z)
{
float X = (this->X - x);
float Y = (this->Y - y);
return (float)(atan(sqrt((X * X) + (Y * Y)) / (this->Z - z)) * (180.0 / M_PI));
}
float Vector3::deltaYaw(Vector3 &o)
{
float X = (this->X - o.X);
float Y = (this->Y - o.Y);
return (float)(atan(sqrt((X * X) + (Y * Y)) / (this->Z - o.Z)) * (180.0 / M_PI));
}
char* Vector3::serialize()
{
char* data = new char[13];
memcpy(data, this->Xc, 4);
memcpy(data + 4, this->Yc, 4);
memcpy(data + 8, this->Zc, 4);
data[12] = 0;
return data;
}
void Vector3::deserialize(char* o)
{
memcpy(o, this->Xc, 4);
memcpy(o + 4, this->Yc, 4);
memcpy(o + 8, this->Zc, 4);
}
DLL_METHOD void Vector3_Set(Vector3* a, float o) {
a->set(o);
}
DLL_METHOD void Vector3_SetP(Vector3* a, float x, float y, float z) {
a->set(x, y, z);
}
DLL_METHOD void Vector3_SetV(Vector3* a, Vector3* b) {
a->set(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Set=_Vector3_Set@8")
#pragma comment(linker, "/EXPORT:Vector3_SetP=_Vector3_SetP@16")
#pragma comment(linker, "/EXPORT:Vector3_SetV=_Vector3_SetV@8")
DLL_METHOD void Vector3_Add(Vector3* a, float o) {
a->add(o);
}
DLL_METHOD void Vector3_AddP(Vector3* a, float x, float y, float z) {
a->add(x, y, z);
}
DLL_METHOD void Vector3_AddV(Vector3* a, Vector3* b) {
a->add(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Add=_Vector3_Add@8")
#pragma comment(linker, "/EXPORT:Vector3_AddP=_Vector3_AddP@16")
#pragma comment(linker, "/EXPORT:Vector3_AddV=_Vector3_AddV@8")
DLL_METHOD void Vector3_Sub(Vector3* a, float o) {
a->sub(o);
}
DLL_METHOD void Vector3_SubP(Vector3* a, float x, float y, float z) {
a->sub(x, y, z);
}
DLL_METHOD void Vector3_SubV(Vector3* a, Vector3* b) {
a->sub(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Sub=_Vector3_Sub@8")
#pragma comment(linker, "/EXPORT:Vector3_SubP=_Vector3_SubP@16")
#pragma comment(linker, "/EXPORT:Vector3_SubV=_Vector3_SubV@8")
DLL_METHOD void Vector3_Mul(Vector3* a, float o) {
a->mul(o);
}
DLL_METHOD void Vector3_MulP(Vector3* a, float x, float y, float z) {
a->mul(x, y, z);
}
DLL_METHOD void Vector3_MulV(Vector3* a, Vector3* b) {
a->mul(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Mul=_Vector3_Mul@8")
#pragma comment(linker, "/EXPORT:Vector3_MulP=_Vector3_MulP@16")
#pragma comment(linker, "/EXPORT:Vector3_MulV=_Vector3_MulV@8")
DLL_METHOD void Vector3_Div(Vector3* a, float o) {
a->div(o);
}
DLL_METHOD void Vector3_DivP(Vector3* a, float x, float y, float z) {
a->div(x, y, z);
}
DLL_METHOD void Vector3_DivV(Vector3* a, Vector3* b) {
a->div(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Div=_Vector3_Div@8")
#pragma comment(linker, "/EXPORT:Vector3_DivP=_Vector3_DivP@16")
#pragma comment(linker, "/EXPORT:Vector3_DivV=_Vector3_DivV@8")
DLL_METHOD float Vector3_Length(Vector3* a) {
return (float)a->length();
}
DLL_METHOD float Vector3_DistanceP(Vector3* a, float x, float y, float z) {
return (float)a->distance(x, y, z);
}
DLL_METHOD float Vector3_DistanceV(Vector3* a, Vector3* b) {
return (float)a->distance(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Length=_Vector3_Length@4")
#pragma comment(linker, "/EXPORT:Vector3_DistanceP=_Vector3_DistanceP@16")
#pragma comment(linker, "/EXPORT:Vector3_DistanceV=_Vector3_DistanceV@8")
DLL_METHOD float Vector3_DotP(Vector3* a, float x, float y, float z) {
return (float)a->dot(x, y, z);
}
DLL_METHOD float Vector3_DotV(Vector3* a, Vector3* b) {
return (float)a->dot(*b);
}
DLL_METHOD void Vector3_CrossP(Vector3* a, float x, float y, float z, Vector3* out) {
Vector3 temp = a->cross(x, y, z);
*out = temp;
}
DLL_METHOD void Vector3_CrossV(Vector3* a, Vector3* b, Vector3* out) {
Vector3 temp = a->cross(*b);
*out = temp;
}
DLL_METHOD void Vector3_Normalize(Vector3* a) {
a->normalize();
}
#pragma comment(linker, "/EXPORT:Vector3_DotP=_Vector3_DotP@16")
#pragma comment(linker, "/EXPORT:Vector3_DotV=_Vector3_DotV@8")
#pragma comment(linker, "/EXPORT:Vector3_CrossP=_Vector3_CrossP@20")
#pragma comment(linker, "/EXPORT:Vector3_CrossV=_Vector3_CrossV@12")
#pragma comment(linker, "/EXPORT:Vector3_Normalize=_Vector3_Normalize@4")
DLL_METHOD void Vector3_Rotate(Vector3* a, float pitch, float yaw, float roll) {
a->rotate(pitch, yaw, roll);
}
DLL_METHOD void Vector3_RotateAroundP(Vector3* a, float x, float y, float z, float pitch, float yaw, float roll) {
a->rotateAround(x, y, z, pitch, yaw, roll);
}
DLL_METHOD void Vector3_RotateAroundV(Vector3* a, Vector3* b, float pitch, float yaw, float roll) {
a->rotateAround(*b, pitch, yaw, roll);
}
#pragma comment(linker, "/EXPORT:Vector3_Rotate=_Vector3_Rotate@16")
#pragma comment(linker, "/EXPORT:Vector3_RotateAroundP=_Vector3_RotateAroundP@28")
#pragma comment(linker, "/EXPORT:Vector3_RotateAroundV=_Vector3_RotateAroundV@20")
DLL_METHOD float Vector3_DeltaPitchP(Vector3* a, float x, float y, float z) {
return (float)a->deltaPitch(x, y, z);
}
DLL_METHOD float Vector3_DeltaPitchV(Vector3* a, Vector3* b) {
return (float)a->deltaPitch(*b);
}
DLL_METHOD float Vector3_DeltaYawP(Vector3* a, float x, float y, float z) {
return (float)a->deltaYaw(x, y, z);
}
DLL_METHOD float Vector3_DeltaYawV(Vector3* a, Vector3* b) {
return (float)a->deltaYaw(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_DeltaPitchP=_Vector3_DeltaPitchP@16")
#pragma comment(linker, "/EXPORT:Vector3_DeltaPitchV=_Vector3_DeltaPitchV@8")
#pragma comment(linker, "/EXPORT:Vector3_DeltaYawP=_Vector3_DeltaYawP@16")
#pragma comment(linker, "/EXPORT:Vector3_DeltaYawV=_Vector3_DeltaYawV@8")
DLL_METHOD char* Vector3_Serialize(Vector3* a) {
return a->serialize();
}
DLL_METHOD void Vector3_Deserialize(Vector3* a, char* s) {
a->deserialize(s);
}
#pragma comment(linker, "/EXPORT:Vector3_Serialize=_Vector3_Serialize@4")
#pragma comment(linker, "/EXPORT:Vector3_Deserialize=_Vector3_Deserialize@8")
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Project Kube (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
#include "Vector3.h"
void Vector3::set(const float &o)
{
this->X = o;
this->Y = o;
this->Z = o;
}
void Vector3::set(const float &x, const float &y, const float &z)
{
this->X = x;
this->Y = y;
this->Z = z;
}
void Vector3::set(const Vector3 &o)
{
if (this != &o) {
this->X = o.X;
this->Y = o.Y;
this->Z = o.Z;
}
}
void Vector3::add(const float &o)
{
this->X += o;
this->Y += o;
this->Z += o;
}
void Vector3::add(const float &x, const float &y, const float &z)
{
this->X += x;
this->Y += y;
this->Z += z;
}
void Vector3::add(const Vector3 &o)
{
this->X += o.X;
this->Y += o.Y;
this->Z += o.Z;
}
void Vector3::sub(const float &o)
{
this->X -= o;
this->Y -= o;
this->Z -= o;
}
void Vector3::sub(const float &x, const float &y, const float &z)
{
this->X -= x;
this->Y -= y;
this->Z -= z;
}
void Vector3::sub(const Vector3 &o)
{
this->X -= o.X;
this->Y -= o.Y;
this->Z -= o.Z;
}
void Vector3::mul(const float &o)
{
this->X *= o;
this->Y *= o;
this->Z *= o;
}
void Vector3::mul(const float &x, const float &y, const float &z)
{
this->X *= x;
this->Y *= y;
this->Z *= z;
}
void Vector3::mul(const Vector3 &o)
{
this->X *= o.X;
this->Y *= o.Y;
this->Z *= o.Z;
}
void Vector3::div(const float &o)
{
this->X /= o;
this->Y /= o;
this->Z /= o;
}
void Vector3::div(const float &x, const float &y, const float &z)
{
this->X /= x;
this->Y /= y;
this->Z /= z;
}
void Vector3::div(const Vector3 &o)
{
this->X /= o.X;
this->Y /= o.Y;
this->Z /= o.Z;
}
float Vector3::length()
{
return sqrt(this->X * this->X + this->Y * this->Y + this->Z * this->Z);
}
float Vector3::distance(const float &x, const float &y, const float &z)
{
float X = (this->X - x);
float Y = (this->Y - y);
float Z = (this->Z - z);
return sqrt(X * X + Y * Y + Z * Z);
}
float Vector3::distance(const Vector3 &o)
{
float X = (this->X - o.X);
float Y = (this->Y - o.Y);
float Z = (this->Z - o.Z);
return sqrt(X * X + Y * Y + Z * Z);
}
float Vector3::dot(const float &x, const float &y, const float &z)
{
return (this->X * x) + (this->Y * y) + (this->Z * z);
}
float Vector3::dot(const Vector3 &o)
{
return (this->X * o.X) + (this->Y * o.Y) + (this->Z * o.Z);
}
Vector3 Vector3::cross(const float &x, const float &y, const float &z)
{
Vector3* data = new Vector3();
data->X = (this->Y * z) - (this->Z * y);
data->Y = (this->Z * x) - (this->X * z);
data->Z = (this->X * y) - (this->Y * x);
return *data;
}
Vector3 Vector3::cross(const Vector3 &o)
{
Vector3* data = new Vector3();
data->X = (this->Y * o.Z) - (this->Z * o.Y);
data->Y = (this->Z * o.X) - (this->X * o.Z);
data->Z = (this->X * o.Y) - (this->Y * o.X);
return *data;
}
void Vector3::normalize()
{
this->div(this->length());
}
void Vector3::rotate(float &pitch, float &yaw, float &roll)
{
float** matrix = new float*[3];
matrix[0] = new float[3]; matrix[1] = new float[3]; matrix[2] = new float[3];
matrix[0][0] = cos(yaw) * cos(roll); matrix[0][1] = -sin(roll); matrix[0][2] = sin(yaw);
matrix[1][0] = sin(roll); matrix[1][1] = cos(pitch) * cos(roll); matrix[1][2] = -sin(pitch);
matrix[2][0] = -sin(yaw); matrix[2][1] = sin(pitch); matrix[2][2] = cos(pitch) * cos(yaw);
float X = (this->X * matrix[0][0]) + (this->Y * matrix[0][1]) + (this->Z * matrix[0][2]);
float Y = (this->X * matrix[1][0]) + (this->Y * matrix[1][1]) + (this->Z * matrix[1][2]);
float Z = (this->X * matrix[2][0]) + (this->Y * matrix[2][1]) + (this->Z * matrix[2][2]);
this->X = X; this->Y = Y; this->Z = Z;
}
void Vector3::rotateAround(const float &x, const float &y, const float &z, float &pitch, float &yaw, float &roll)
{
this->sub(x, y, z);
this->rotate(pitch, yaw, roll);
this->add(x, y, z);
}
void Vector3::rotateAround(Vector3 &o, float &pitch, float &yaw, float &roll)
{
this->sub(o);
this->rotate(pitch, yaw, roll);
this->add(o);
}
float Vector3::deltaPitch() {
return (float)(atan(this->X / -this->Y) * (180.0 / M_PI));
}
float Vector3::deltaPitch(const float &x, const float &y, const float &z)
{
return (float)(atan((this->X - x) / (-(this->Y - y))) * (180.0 / M_PI));
}
float Vector3::deltaPitch(Vector3 &o)
{
return (float)(atan((this->X - o.X) / (-(this->Y - o.Y))) * (180.0 / M_PI));
}
float Vector3::deltaYaw() {
return (float)(atan(sqrt((this->X * this->X) + (this->Y * this->Y)) / this->Z) * (180.0 / M_PI));
}
float Vector3::deltaYaw(const float &x, const float &y, const float &z)
{
float X = (this->X - x);
float Y = (this->Y - y);
return (float)(atan(sqrt((X * X) + (Y * Y)) / (this->Z - z)) * (180.0 / M_PI));
}
float Vector3::deltaYaw(Vector3 &o)
{
float X = (this->X - o.X);
float Y = (this->Y - o.Y);
return (float)(atan(sqrt((X * X) + (Y * Y)) / (this->Z - o.Z)) * (180.0 / M_PI));
}
char* Vector3::serialize()
{
char* data = new char[13];
memcpy(data, this->Xc, 4);
memcpy(data + 4, this->Yc, 4);
memcpy(data + 8, this->Zc, 4);
data[12] = 0;
return data;
}
void Vector3::deserialize(char* o)
{
memcpy(o, this->Xc, 4);
memcpy(o + 4, this->Yc, 4);
memcpy(o + 8, this->Zc, 4);
}
DLL_METHOD void Vector3_Set(Vector3* a, float o) {
a->set(o);
}
DLL_METHOD void Vector3_SetP(Vector3* a, float x, float y, float z) {
a->set(x, y, z);
}
DLL_METHOD void Vector3_SetV(Vector3* a, Vector3* b) {
a->set(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Set=_Vector3_Set@8")
#pragma comment(linker, "/EXPORT:Vector3_SetP=_Vector3_SetP@16")
#pragma comment(linker, "/EXPORT:Vector3_SetV=_Vector3_SetV@8")
DLL_METHOD void Vector3_Add(Vector3* a, float o) {
a->add(o);
}
DLL_METHOD void Vector3_AddP(Vector3* a, float x, float y, float z) {
a->add(x, y, z);
}
DLL_METHOD void Vector3_AddV(Vector3* a, Vector3* b) {
a->add(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Add=_Vector3_Add@8")
#pragma comment(linker, "/EXPORT:Vector3_AddP=_Vector3_AddP@16")
#pragma comment(linker, "/EXPORT:Vector3_AddV=_Vector3_AddV@8")
DLL_METHOD void Vector3_Sub(Vector3* a, float o) {
a->sub(o);
}
DLL_METHOD void Vector3_SubP(Vector3* a, float x, float y, float z) {
a->sub(x, y, z);
}
DLL_METHOD void Vector3_SubV(Vector3* a, Vector3* b) {
a->sub(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Sub=_Vector3_Sub@8")
#pragma comment(linker, "/EXPORT:Vector3_SubP=_Vector3_SubP@16")
#pragma comment(linker, "/EXPORT:Vector3_SubV=_Vector3_SubV@8")
DLL_METHOD void Vector3_Mul(Vector3* a, float o) {
a->mul(o);
}
DLL_METHOD void Vector3_MulP(Vector3* a, float x, float y, float z) {
a->mul(x, y, z);
}
DLL_METHOD void Vector3_MulV(Vector3* a, Vector3* b) {
a->mul(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Mul=_Vector3_Mul@8")
#pragma comment(linker, "/EXPORT:Vector3_MulP=_Vector3_MulP@16")
#pragma comment(linker, "/EXPORT:Vector3_MulV=_Vector3_MulV@8")
DLL_METHOD void Vector3_Div(Vector3* a, float o) {
a->div(o);
}
DLL_METHOD void Vector3_DivP(Vector3* a, float x, float y, float z) {
a->div(x, y, z);
}
DLL_METHOD void Vector3_DivV(Vector3* a, Vector3* b) {
a->div(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Div=_Vector3_Div@8")
#pragma comment(linker, "/EXPORT:Vector3_DivP=_Vector3_DivP@16")
#pragma comment(linker, "/EXPORT:Vector3_DivV=_Vector3_DivV@8")
DLL_METHOD float Vector3_Length(Vector3* a) {
return (float)a->length();
}
DLL_METHOD float Vector3_DistanceP(Vector3* a, float x, float y, float z) {
return (float)a->distance(x, y, z);
}
DLL_METHOD float Vector3_DistanceV(Vector3* a, Vector3* b) {
return (float)a->distance(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Length=_Vector3_Length@4")
#pragma comment(linker, "/EXPORT:Vector3_DistanceP=_Vector3_DistanceP@16")
#pragma comment(linker, "/EXPORT:Vector3_DistanceV=_Vector3_DistanceV@8")
DLL_METHOD float Vector3_DotP(Vector3* a, float x, float y, float z) {
return (float)a->dot(x, y, z);
}
DLL_METHOD float Vector3_DotV(Vector3* a, Vector3* b) {
return (float)a->dot(*b);
}
DLL_METHOD void Vector3_CrossP(Vector3* a, float x, float y, float z, Vector3* out) {
Vector3 temp = a->cross(x, y, z);
*out = temp;
}
DLL_METHOD void Vector3_CrossV(Vector3* a, Vector3* b, Vector3* out) {
Vector3 temp = a->cross(*b);
*out = temp;
}
DLL_METHOD void Vector3_Normalize(Vector3* a) {
a->normalize();
}
#pragma comment(linker, "/EXPORT:Vector3_DotP=_Vector3_DotP@16")
#pragma comment(linker, "/EXPORT:Vector3_DotV=_Vector3_DotV@8")
#pragma comment(linker, "/EXPORT:Vector3_CrossP=_Vector3_CrossP@20")
#pragma comment(linker, "/EXPORT:Vector3_CrossV=_Vector3_CrossV@12")
#pragma comment(linker, "/EXPORT:Vector3_Normalize=_Vector3_Normalize@4")
DLL_METHOD void Vector3_Rotate(Vector3* a, float pitch, float yaw, float roll) {
a->rotate(pitch, yaw, roll);
}
DLL_METHOD void Vector3_RotateAroundP(Vector3* a, float x, float y, float z, float pitch, float yaw, float roll) {
a->rotateAround(x, y, z, pitch, yaw, roll);
}
DLL_METHOD void Vector3_RotateAroundV(Vector3* a, Vector3* b, float pitch, float yaw, float roll) {
a->rotateAround(*b, pitch, yaw, roll);
}
#pragma comment(linker, "/EXPORT:Vector3_Rotate=_Vector3_Rotate@16")
#pragma comment(linker, "/EXPORT:Vector3_RotateAroundP=_Vector3_RotateAroundP@28")
#pragma comment(linker, "/EXPORT:Vector3_RotateAroundV=_Vector3_RotateAroundV@20")
DLL_METHOD float Vector3_DeltaPitchP(Vector3* a, float x, float y, float z) {
return (float)a->deltaPitch(x, y, z);
}
DLL_METHOD float Vector3_DeltaPitchV(Vector3* a, Vector3* b) {
return (float)a->deltaPitch(*b);
}
DLL_METHOD float Vector3_DeltaYawP(Vector3* a, float x, float y, float z) {
return (float)a->deltaYaw(x, y, z);
}
DLL_METHOD float Vector3_DeltaYawV(Vector3* a, Vector3* b) {
return (float)a->deltaYaw(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_DeltaPitchP=_Vector3_DeltaPitchP@16")
#pragma comment(linker, "/EXPORT:Vector3_DeltaPitchV=_Vector3_DeltaPitchV@8")
#pragma comment(linker, "/EXPORT:Vector3_DeltaYawP=_Vector3_DeltaYawP@16")
#pragma comment(linker, "/EXPORT:Vector3_DeltaYawV=_Vector3_DeltaYawV@8")
DLL_METHOD char* Vector3_Serialize(Vector3* a) {
return a->serialize();
}
DLL_METHOD void Vector3_Deserialize(Vector3* a, char* s) {
a->deserialize(s);
}
#pragma comment(linker, "/EXPORT:Vector3_Serialize=_Vector3_Serialize@4")
#pragma comment(linker, "/EXPORT:Vector3_Deserialize=_Vector3_Deserialize@8")
*/
+81 -81
View File
@@ -1,82 +1,82 @@
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Project Kube (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
#pragma once
#include "dllmain.h"
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#include <math.h>
#undef _USE_MATH_DEFINES
#endif
struct Vector3 {
union {
float X;
char Xc[4];
};
union {
float Y;
char Yc[4];
};
union {
float Z;
char Zc[4];
};
void set(const float &o);
void set(const float &x, const float &y, const float &z);
void set(const Vector3 &o);
void add(const float &o);
void add(const float &x, const float &y, const float &z);
void add(const Vector3 &o);
void sub(const float &o);
void sub(const float &x, const float &y, const float &z);
void sub(const Vector3 &o);
void mul(const float &o);
void mul(const float &x, const float &y, const float &z);
void mul(const Vector3 &o);
void div(const float &o);
void div(const float &x, const float &y, const float &z);
void div(const Vector3 &o);
float length();
float distance(const float &x, const float &y, const float &z);
float distance(const Vector3 &o);
float dot(const float &x, const float &y, const float &z);
float dot(const Vector3 &o);
Vector3 cross(const float &x, const float &y, const float &z);
Vector3 cross(const Vector3 &o);
void normalize();
void rotate(float &pitch, float &yaw, float &roll);
void rotateAround(const float &x, const float &y, const float &z, float &pitch, float &yaw, float &roll);
void rotateAround(Vector3 &o, float &pitch, float &yaw, float &roll);
float deltaPitch();
float deltaPitch(const float &x, const float &y, const float &z);
float deltaPitch(Vector3 &o);
float deltaYaw();
float deltaYaw(const float &x, const float &y, const float &z);
float deltaYaw(Vector3 &o);
char* serialize();
void deserialize(char* o);
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Project Kube (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
#pragma once
#include "dllmain.h"
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#include <math.h>
#undef _USE_MATH_DEFINES
#endif
struct Vector3 {
union {
float X;
char Xc[4];
};
union {
float Y;
char Yc[4];
};
union {
float Z;
char Zc[4];
};
void set(const float &o);
void set(const float &x, const float &y, const float &z);
void set(const Vector3 &o);
void add(const float &o);
void add(const float &x, const float &y, const float &z);
void add(const Vector3 &o);
void sub(const float &o);
void sub(const float &x, const float &y, const float &z);
void sub(const Vector3 &o);
void mul(const float &o);
void mul(const float &x, const float &y, const float &z);
void mul(const Vector3 &o);
void div(const float &o);
void div(const float &x, const float &y, const float &z);
void div(const Vector3 &o);
float length();
float distance(const float &x, const float &y, const float &z);
float distance(const Vector3 &o);
float dot(const float &x, const float &y, const float &z);
float dot(const Vector3 &o);
Vector3 cross(const float &x, const float &y, const float &z);
Vector3 cross(const Vector3 &o);
void normalize();
void rotate(float &pitch, float &yaw, float &roll);
void rotateAround(const float &x, const float &y, const float &z, float &pitch, float &yaw, float &roll);
void rotateAround(Vector3 &o, float &pitch, float &yaw, float &roll);
float deltaPitch();
float deltaPitch(const float &x, const float &y, const float &z);
float deltaPitch(Vector3 &o);
float deltaYaw();
float deltaYaw(const float &x, const float &y, const float &z);
float deltaYaw(Vector3 &o);
char* serialize();
void deserialize(char* o);
};*/
+132 -132
View File
@@ -1,132 +1,132 @@
#include "Common.h"
#include <memory>
#include <sstream>
// Rev-engineered from https://github.com/blitz-research/blitz3d/blob/master/compiler/declnode.cpp
#define BBVARTYPE_GLOBAL 0
#define BBVARTYPE_INT 1
#define BBVARTYPE_FLOAT 2
#define BBVARTYPE_UNUSED 3
#define BBVARTYPE_STRING 4
#define BBVARTYPE_TYPE 5
#define BBVARTYPE_ARRAY 6
struct BBVar {
int Type = -1;
};
struct BBVarGlobal {
int GlobalType = -1;
int* Value;
};
struct BBVarInt : BBVar {
int Value;
};
struct BBVarFloat : BBVar {
float Value;
};
struct BBVarUnused : BBVar {
// Not a Dim, as you can see here:
// https://github.com/blitz-research/blitz3d/blob/master/compiler/stmtnode.cpp#L86
};
struct BBVarString : BBVar {
int Length;
char* Value;
};
struct BBVarElement;
struct BBVarType : BBVar {
BBVarElement used, free;
int fieldCount; // Field Info follows (Exactly <fieldCount> int pointers to variable struct)
int* fields[];
};
struct BBVarElement {
int* currentPtr; // Points towards fields.
int* nextPtr, prevPtr;
BBVarType* BBStructPtr;
int refCount; // Fields usually follow here, may be at another location, see currentPtr.
//BBVar* fields[];
};
struct BBVarArray : BBVar {
int Size; //???
BBVar* ArrayType;
};
std::string BBVar_Serialize(void* obj) {
std::stringstream myStream;
BBVar* var = (BBVar*)obj;
switch (var->Type) {
case BBVARTYPE_GLOBAL:
BBVarGlobal* varGlobal = (BBVarGlobal*)obj;
myStream << "[Global] " << BBVar_Serialize(varGlobal->Value) << std::endl;
break;
case BBVARTYPE_INT:
BBVarInt* varInt = (BBVarInt*)obj;
myStream << "Int" << std::endl;
break;
case BBVARTYPE_FLOAT:
BBVarFloat* varFloat = (BBVarFloat*)obj;
myStream << "Float" << std::endl;
break;
case BBVARTYPE_UNUSED:
BBVarUnused* varUnused = (BBVarUnused*)obj;
myStream << "Unused" << std::endl;
break;
case BBVARTYPE_STRING:
BBVarString* varString = (BBVarString*)obj;
myStream << "String" << std::endl;
break;
case BBVARTYPE_TYPE:
BBVarType* varType = (BBVarType*)obj;
myStream << BBVarType_Serialize(varType);
break;
case BBVARTYPE_ARRAY:
BBVarArray* varArray = (BBVarArray*)obj;
myStream << "Array = " << std::endl;
break;
}
return myStream.str();
}
std::string BBVarType_Serialize(BBVarType* obj, unsigned int indent = 0) {
std::stringstream myStream;
std::stringstream myPaddingSS;
for (unsigned int pad = 0; pad < indent; pad++) {
myPaddingSS << " ";
}
std::string myPadding = myPaddingSS.str();
myStream << myPadding << "Type {" << std::endl;
for (unsigned int fld = 0; fld < obj->fieldCount; fld++) {
myStream << myPadding << " (" << fld << ") => " << BBVar_Serialize(obj->fields[fld]) << std::endl;
}
myStream << myPadding << "}" << std::endl;
return myStream.str();
}
DLL_EXPORT(char*) SerializeObject(void* obj) {
return strdup(BBVar_Serialize(obj).c_str());
}
// Laut Mark Sibly:
struct BBType {
int obj_size;
BBObj usedList, freeList;
};
struct BBObj {
BBObj *curr;
BBObj *next, *prev;
int* bbtype;
int ref_cnt;
};
#include "Common.h"
#include <memory>
#include <sstream>
// Rev-engineered from https://github.com/blitz-research/blitz3d/blob/master/compiler/declnode.cpp
#define BBVARTYPE_GLOBAL 0
#define BBVARTYPE_INT 1
#define BBVARTYPE_FLOAT 2
#define BBVARTYPE_UNUSED 3
#define BBVARTYPE_STRING 4
#define BBVARTYPE_TYPE 5
#define BBVARTYPE_ARRAY 6
struct BBVar {
int Type = -1;
};
struct BBVarGlobal {
int GlobalType = -1;
int* Value;
};
struct BBVarInt : BBVar {
int Value;
};
struct BBVarFloat : BBVar {
float Value;
};
struct BBVarUnused : BBVar {
// Not a Dim, as you can see here:
// https://github.com/blitz-research/blitz3d/blob/master/compiler/stmtnode.cpp#L86
};
struct BBVarString : BBVar {
int Length;
char* Value;
};
struct BBVarElement;
struct BBVarType : BBVar {
BBVarElement used, free;
int fieldCount; // Field Info follows (Exactly <fieldCount> int pointers to variable struct)
int* fields[];
};
struct BBVarElement {
int* currentPtr; // Points towards fields.
int* nextPtr, prevPtr;
BBVarType* BBStructPtr;
int refCount; // Fields usually follow here, may be at another location, see currentPtr.
//BBVar* fields[];
};
struct BBVarArray : BBVar {
int Size; //???
BBVar* ArrayType;
};
std::string BBVar_Serialize(void* obj) {
std::stringstream myStream;
BBVar* var = (BBVar*)obj;
switch (var->Type) {
case BBVARTYPE_GLOBAL:
BBVarGlobal* varGlobal = (BBVarGlobal*)obj;
myStream << "[Global] " << BBVar_Serialize(varGlobal->Value) << std::endl;
break;
case BBVARTYPE_INT:
BBVarInt* varInt = (BBVarInt*)obj;
myStream << "Int" << std::endl;
break;
case BBVARTYPE_FLOAT:
BBVarFloat* varFloat = (BBVarFloat*)obj;
myStream << "Float" << std::endl;
break;
case BBVARTYPE_UNUSED:
BBVarUnused* varUnused = (BBVarUnused*)obj;
myStream << "Unused" << std::endl;
break;
case BBVARTYPE_STRING:
BBVarString* varString = (BBVarString*)obj;
myStream << "String" << std::endl;
break;
case BBVARTYPE_TYPE:
BBVarType* varType = (BBVarType*)obj;
myStream << BBVarType_Serialize(varType);
break;
case BBVARTYPE_ARRAY:
BBVarArray* varArray = (BBVarArray*)obj;
myStream << "Array = " << std::endl;
break;
}
return myStream.str();
}
std::string BBVarType_Serialize(BBVarType* obj, unsigned int indent = 0) {
std::stringstream myStream;
std::stringstream myPaddingSS;
for (unsigned int pad = 0; pad < indent; pad++) {
myPaddingSS << " ";
}
std::string myPadding = myPaddingSS.str();
myStream << myPadding << "Type {" << std::endl;
for (unsigned int fld = 0; fld < obj->fieldCount; fld++) {
myStream << myPadding << " (" << fld << ") => " << BBVar_Serialize(obj->fields[fld]) << std::endl;
}
myStream << myPadding << "}" << std::endl;
return myStream.str();
}
DLL_EXPORT(char*) SerializeObject(void* obj) {
return strdup(BBVar_Serialize(obj).c_str());
}
// Laut Mark Sibly:
struct BBType {
int obj_size;
BBObj usedList, freeList;
};
struct BBObj {
BBObj *curr;
BBObj *next, *prev;
int* bbtype;
int ref_cnt;
};
+121 -121
View File
@@ -1,122 +1,122 @@
// Blitz - Steam wrapper for Blitz.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Long.h"
DLL_FUNCTION(double_t*) BU_Double_New() {
return new double_t;
}
DLL_FUNCTION(double_t*) BU_Double_Copy(double_t* pOther) {
return new double_t(*pOther);
}
DLL_FUNCTION(void) BU_Double_Destroy(double_t* pThis) {
delete pThis;
}
char* BU_Double_Buffer = new char[32];
DLL_FUNCTION(const char*) BU_Double_ToString(double_t* pThis) {
std::stringstream myStream;
myStream << (*pThis);
const char* myBuffer = myStream.str().c_str();
strcpy_s(BU_Double_Buffer, 32, myBuffer);
return BU_Double_Buffer;
}
DLL_FUNCTION(double_t*) BU_Double_FromString(const char* pString) {
double_t* pThis = new double_t;
std::stringstream myStream = std::stringstream(pString);
myStream >> *pThis;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_FromF(float_t fOther) {
return new double_t(fOther);
}
DLL_FUNCTION(float_t) BU_Double_ToF(double_t* pThis) {
return (float_t)*pThis;
}
DLL_FUNCTION(double_t*) BU_Double_FromI(int32_t iOther) {
return new double_t(iOther);
}
DLL_FUNCTION(int32_t) BU_Double_ToI(double_t* pThis) {
return (int32_t)*pThis;
}
DLL_FUNCTION(double_t*) BU_Double_FromL(int64_t* pOther) {
return new double_t((double_t)*pOther);
}
DLL_FUNCTION(int64_t*) BU_Double_ToL(double_t* pThis) {
return new int64_t((int64_t)*pThis);
}
DLL_FUNCTION(int32_t) BU_Double_Compare(double_t* pThis, double_t* pOther) {
return /* It can either be Equal (0) or Smaller or Greater. Easy to check. */
/* Greater */
(*pThis > *pOther ? 1 : 0) +
/* Smaller */
(*pThis < *pOther ? -1 : 0);
}
DLL_FUNCTION(double_t*) BU_Double_Set(double_t* pThis, double_t* pOther) {
*pThis = *pOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_Add(double_t* pThis, double_t* pOther) {
*pThis += *pOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_Sub(double_t* pThis, double_t* pOther) {
*pThis -= *pOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_Div(double_t* pThis, double_t* pOther) {
*pThis /= *pOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_Mul(double_t* pThis, double_t* pOther) {
*pThis *= *pOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_Mod(double_t* pThis, double_t* pOther) {
*pThis = fmod(*pThis, *pOther);
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_SetF(double_t* pThis, float_t fOther) {
*pThis = fOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_AddF(double_t* pThis, float_t fOther) {
*pThis += fOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_SubF(double_t* pThis, float_t fOther) {
*pThis -= fOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_DivF(double_t* pThis, float_t fOther) {
*pThis /= fOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_MulF(double_t* pThis, float_t fOther) {
*pThis *= fOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_ModF(double_t* pThis, float_t fOther) {
*pThis = fmod(*pThis, fOther);
return pThis;
// Blitz - Steam wrapper for Blitz.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Long.h"
DLL_FUNCTION(double_t*) BU_Double_New() {
return new double_t;
}
DLL_FUNCTION(double_t*) BU_Double_Copy(double_t* pOther) {
return new double_t(*pOther);
}
DLL_FUNCTION(void) BU_Double_Destroy(double_t* pThis) {
delete pThis;
}
char* BU_Double_Buffer = new char[32];
DLL_FUNCTION(const char*) BU_Double_ToString(double_t* pThis) {
std::stringstream myStream;
myStream << (*pThis);
const char* myBuffer = myStream.str().c_str();
strcpy_s(BU_Double_Buffer, 32, myBuffer);
return BU_Double_Buffer;
}
DLL_FUNCTION(double_t*) BU_Double_FromString(const char* pString) {
double_t* pThis = new double_t;
std::stringstream myStream = std::stringstream(pString);
myStream >> *pThis;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_FromF(float_t fOther) {
return new double_t(fOther);
}
DLL_FUNCTION(float_t) BU_Double_ToF(double_t* pThis) {
return (float_t)*pThis;
}
DLL_FUNCTION(double_t*) BU_Double_FromI(int32_t iOther) {
return new double_t(iOther);
}
DLL_FUNCTION(int32_t) BU_Double_ToI(double_t* pThis) {
return (int32_t)*pThis;
}
DLL_FUNCTION(double_t*) BU_Double_FromL(int64_t* pOther) {
return new double_t((double_t)*pOther);
}
DLL_FUNCTION(int64_t*) BU_Double_ToL(double_t* pThis) {
return new int64_t((int64_t)*pThis);
}
DLL_FUNCTION(int32_t) BU_Double_Compare(double_t* pThis, double_t* pOther) {
return /* It can either be Equal (0) or Smaller or Greater. Easy to check. */
/* Greater */
(*pThis > *pOther ? 1 : 0) +
/* Smaller */
(*pThis < *pOther ? -1 : 0);
}
DLL_FUNCTION(double_t*) BU_Double_Set(double_t* pThis, double_t* pOther) {
*pThis = *pOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_Add(double_t* pThis, double_t* pOther) {
*pThis += *pOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_Sub(double_t* pThis, double_t* pOther) {
*pThis -= *pOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_Div(double_t* pThis, double_t* pOther) {
*pThis /= *pOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_Mul(double_t* pThis, double_t* pOther) {
*pThis *= *pOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_Mod(double_t* pThis, double_t* pOther) {
*pThis = fmod(*pThis, *pOther);
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_SetF(double_t* pThis, float_t fOther) {
*pThis = fOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_AddF(double_t* pThis, float_t fOther) {
*pThis += fOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_SubF(double_t* pThis, float_t fOther) {
*pThis -= fOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_DivF(double_t* pThis, float_t fOther) {
*pThis /= fOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_MulF(double_t* pThis, float_t fOther) {
*pThis *= fOther;
return pThis;
}
DLL_FUNCTION(double_t*) BU_Double_ModF(double_t* pThis, float_t fOther) {
*pThis = fmod(*pThis, fOther);
return pThis;
}
+51 -51
View File
@@ -1,51 +1,51 @@
// Blitz - Steam wrapper for Blitz.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "BlitzUtility.h"
#include <sstream>
DLL_FUNCTION(double_t*) BU_Double_New();
DLL_FUNCTION(double_t*) BU_Double_Copy(double_t* pRight);
DLL_FUNCTION(void) BU_Double_Destroy(double_t* pThis);
DLL_FUNCTION(const char*) BU_Double_ToString(double_t* pThis);
DLL_FUNCTION(double_t*) BU_Double_FromString(const char* pString);
DLL_FUNCTION(double_t*) BU_Double_FromF(float_t fOther);
DLL_FUNCTION(float_t) BU_Double_ToF(double_t* pThis);
DLL_FUNCTION(double_t*) BU_Double_FromI(int32_t iOther);
DLL_FUNCTION(int32_t) BU_Double_ToI(double_t* pThis);
DLL_FUNCTION(double_t*) BU_Double_FromL(int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Double_ToL(double_t* pThis);
DLL_FUNCTION(int32_t) BU_Double_Compare(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BU_Double_Set(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BU_Double_Add(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BU_Double_Sub(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BU_Double_Div(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BU_Double_Mul(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BU_Double_Mod(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BU_Double_SetF(double_t* pThis, float_t fOther);
DLL_FUNCTION(double_t*) BU_Double_AddF(double_t* pThis, float_t fOther);
DLL_FUNCTION(double_t*) BU_Double_SubF(double_t* pThis, float_t fOther);
DLL_FUNCTION(double_t*) BU_Double_DivF(double_t* pThis, float_t fOther);
DLL_FUNCTION(double_t*) BU_Double_MulF(double_t* pThis, float_t fOther);
DLL_FUNCTION(double_t*) BU_Double_ModF(double_t* pThis, float_t fOther);
// Blitz - Steam wrapper for Blitz.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "BlitzUtility.h"
#include <sstream>
DLL_FUNCTION(double_t*) BU_Double_New();
DLL_FUNCTION(double_t*) BU_Double_Copy(double_t* pRight);
DLL_FUNCTION(void) BU_Double_Destroy(double_t* pThis);
DLL_FUNCTION(const char*) BU_Double_ToString(double_t* pThis);
DLL_FUNCTION(double_t*) BU_Double_FromString(const char* pString);
DLL_FUNCTION(double_t*) BU_Double_FromF(float_t fOther);
DLL_FUNCTION(float_t) BU_Double_ToF(double_t* pThis);
DLL_FUNCTION(double_t*) BU_Double_FromI(int32_t iOther);
DLL_FUNCTION(int32_t) BU_Double_ToI(double_t* pThis);
DLL_FUNCTION(double_t*) BU_Double_FromL(int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Double_ToL(double_t* pThis);
DLL_FUNCTION(int32_t) BU_Double_Compare(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BU_Double_Set(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BU_Double_Add(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BU_Double_Sub(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BU_Double_Div(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BU_Double_Mul(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BU_Double_Mod(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BU_Double_SetF(double_t* pThis, float_t fOther);
DLL_FUNCTION(double_t*) BU_Double_AddF(double_t* pThis, float_t fOther);
DLL_FUNCTION(double_t*) BU_Double_SubF(double_t* pThis, float_t fOther);
DLL_FUNCTION(double_t*) BU_Double_DivF(double_t* pThis, float_t fOther);
DLL_FUNCTION(double_t*) BU_Double_MulF(double_t* pThis, float_t fOther);
DLL_FUNCTION(double_t*) BU_Double_ModF(double_t* pThis, float_t fOther);
+219 -219
View File
@@ -1,220 +1,220 @@
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Project Kube (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
#pragma once
#include "FVector2.h"
double FVector2::length()
{
return std::sqrtf(std::abs((this->X*this->X) + (this->Y*this->Y)));
}
void FVector2::normalize() {
double len = this->length();
double divisor = 1.0 / (len != 0 ? len : FLT_EPSILON);
}
double FVector2::distance(const FVector2 r)
{
float X = (this->X - r.X), Y = (this->Y - r.Y);
return std::sqrtf(std::abs(X*X + Y*Y));
}
const char* FVector2::serialize() {
}
FVector2& FVector2::deserialize(const char* serialized) {
}
FVector2::FVector2(float V) {
}
FVector2::FVector2(float X, float Y) {
}
FVector2::FVector2(FVector2& V) {
}
FVector2& FVector2::operator++() {
}
FVector2& FVector2::operator--() {
}
bool FVector2::operator>(const FVector2& r) {
}
bool FVector2::operator>(const float& r) {
}
bool FVector2::operator<(const FVector2& r) {
}
bool FVector2::operator<(const float& r) {
}
bool FVector2::operator==(const FVector2& r) {
}
bool FVector2::operator==(const float& r) {
}
bool FVector2::operator>=(const FVector2& r) {
}
bool FVector2::operator>=(const float& r) {
}
bool FVector2::operator<=(const FVector2& r) {
}
bool FVector2::operator<=(const float& r) {
}
bool FVector2::operator!=(const FVector2& r) {
}
bool FVector2::operator!=(const float& r) {
}
FVector2& FVector2::operator=(const FVector2& r) {
}
FVector2& FVector2::operator=(const float& r) {
}
FVector2& FVector2::operator+(const FVector2& r) {
}
FVector2& FVector2::operator+(const float& r) {
}
FVector2& FVector2::operator-(const FVector2& r) {
}
FVector2& FVector2::operator*(const FVector2& r) {
}
FVector2& FVector2::operator*(const float& r) {
}
FVector2& FVector2::operator/(const FVector2& r) {
}
FVector2& FVector2::operator/(const float& r) {
}
FVector2& FVector2::operator+=(const FVector2& r) {
}
FVector2& FVector2::operator+=(const float& r) {
}
FVector2& FVector2::operator-=(const FVector2& r) {
}
FVector2& FVector2::operator*=(const FVector2& r) {
}
FVector2& FVector2::operator*=(const float& r) {
}
FVector2& FVector2::operator/=(const FVector2& r) {
}
FVector2& FVector2::operator/=(const float& r) {
}
FVector2& FVector2::operator-(const float& r) {
}
FVector2& FVector2::operator-=(const float& r) {
}
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Project Kube (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
#pragma once
#include "FVector2.h"
double FVector2::length()
{
return std::sqrtf(std::abs((this->X*this->X) + (this->Y*this->Y)));
}
void FVector2::normalize() {
double len = this->length();
double divisor = 1.0 / (len != 0 ? len : FLT_EPSILON);
}
double FVector2::distance(const FVector2 r)
{
float X = (this->X - r.X), Y = (this->Y - r.Y);
return std::sqrtf(std::abs(X*X + Y*Y));
}
const char* FVector2::serialize() {
}
FVector2& FVector2::deserialize(const char* serialized) {
}
FVector2::FVector2(float V) {
}
FVector2::FVector2(float X, float Y) {
}
FVector2::FVector2(FVector2& V) {
}
FVector2& FVector2::operator++() {
}
FVector2& FVector2::operator--() {
}
bool FVector2::operator>(const FVector2& r) {
}
bool FVector2::operator>(const float& r) {
}
bool FVector2::operator<(const FVector2& r) {
}
bool FVector2::operator<(const float& r) {
}
bool FVector2::operator==(const FVector2& r) {
}
bool FVector2::operator==(const float& r) {
}
bool FVector2::operator>=(const FVector2& r) {
}
bool FVector2::operator>=(const float& r) {
}
bool FVector2::operator<=(const FVector2& r) {
}
bool FVector2::operator<=(const float& r) {
}
bool FVector2::operator!=(const FVector2& r) {
}
bool FVector2::operator!=(const float& r) {
}
FVector2& FVector2::operator=(const FVector2& r) {
}
FVector2& FVector2::operator=(const float& r) {
}
FVector2& FVector2::operator+(const FVector2& r) {
}
FVector2& FVector2::operator+(const float& r) {
}
FVector2& FVector2::operator-(const FVector2& r) {
}
FVector2& FVector2::operator*(const FVector2& r) {
}
FVector2& FVector2::operator*(const float& r) {
}
FVector2& FVector2::operator/(const FVector2& r) {
}
FVector2& FVector2::operator/(const float& r) {
}
FVector2& FVector2::operator+=(const FVector2& r) {
}
FVector2& FVector2::operator+=(const float& r) {
}
FVector2& FVector2::operator-=(const FVector2& r) {
}
FVector2& FVector2::operator*=(const FVector2& r) {
}
FVector2& FVector2::operator*=(const float& r) {
}
FVector2& FVector2::operator/=(const FVector2& r) {
}
FVector2& FVector2::operator/=(const float& r) {
}
FVector2& FVector2::operator-(const float& r) {
}
FVector2& FVector2::operator-=(const float& r) {
}
*/
+97 -97
View File
@@ -1,98 +1,98 @@
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Project Kube (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
#pragma once
#include "dllmain.h"
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#include <math.h>
#undef _USE_MATH_DEFINES
#endif
struct FVector2 {
float X, Y;
// Constructor & Destructor
FVector2(float V);
FVector2(float X, float Y);
FVector2(FVector2& V);
// Operator Overloading
FVector2& operator++();
FVector2& operator--();
bool operator>(const FVector2& r);
bool operator<(const FVector2& r);
bool operator==(const FVector2& r);
bool operator>=(const FVector2& r);
bool operator<=(const FVector2& r);
bool operator!=(const FVector2& r);
FVector2& operator=(const FVector2& r);
FVector2& operator+(const FVector2& r);
FVector2& operator-(const FVector2& r);
FVector2& operator*(const FVector2& r);
FVector2& operator/(const FVector2& r);
FVector2& operator+=(const FVector2& r);
FVector2& operator-=(const FVector2& r);
FVector2& operator*=(const FVector2& r);
FVector2& operator/=(const FVector2& r);
// Operator Overloading - float
bool operator>(const float& r);
bool operator<(const float& r);
bool operator==(const float& r);
bool operator>=(const float& r);
bool operator<=(const float& r);
bool operator!=(const float& r);
FVector2& operator=(const float& r);
FVector2& operator+(const float& r);
FVector2& operator-(const float& r);
FVector2& operator*(const float& r);
FVector2& operator/(const float& r);
FVector2& operator+=(const float& r);
FVector2& operator-=(const float& r);
FVector2& operator*=(const float& r);
FVector2& operator/=(const float& r);
// Simple Math
double length();
void normalize();
double distance(const FVector2 r);
// Advanced Math
void rotate(const double )
// Serialization
const char* serialize();
static FVector2& deserialize(const char* serialized);
};
DLL_METHOD FVector2* DLL_CALL BU_FVector2_Create();
DLL_METHOD FVector2* DLL_CALL BU_FVector2_Copy(FVector2* copyVector);
DLL_METHOD void DLL_CALL BU_FVector2_Destroy();
DLL_METHOD FVector2* DLL_CALL BU_FVector2_TempCreate();
DLL_METHOD FVector2* DLL_CALL BU_FVector2_TempCopy(FVector2* copyVector);
DLL_METHOD void DLL_CALL BU_FVector2_SetTemp(FVector2* vector);
DLL_METHOD void DLL_CALL BU_FVector2_UnsetTemp(FVector2* vector);
DLL_METHOD void DLL_CALL BU_FVector2_TempCleanup();
DLL_METHOD float DLL_CALL BU_FVector2_Length(FVector2* vector);
DLL_METHOD float DLL_CALL BU_FVector2_Normalize();
DLL_METHOD float DLL_CALL BU_FVector2_Distance(FVector2* vector);
DLL_METHOD float DLL_CALL BU_FVector2_DistanceL(float X, float Y);
// BlitzUtility - Expanding the normal Blitz functionality.
// Copyright (C) 2015 Project Kube (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
#pragma once
#include "dllmain.h"
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#include <math.h>
#undef _USE_MATH_DEFINES
#endif
struct FVector2 {
float X, Y;
// Constructor & Destructor
FVector2(float V);
FVector2(float X, float Y);
FVector2(FVector2& V);
// Operator Overloading
FVector2& operator++();
FVector2& operator--();
bool operator>(const FVector2& r);
bool operator<(const FVector2& r);
bool operator==(const FVector2& r);
bool operator>=(const FVector2& r);
bool operator<=(const FVector2& r);
bool operator!=(const FVector2& r);
FVector2& operator=(const FVector2& r);
FVector2& operator+(const FVector2& r);
FVector2& operator-(const FVector2& r);
FVector2& operator*(const FVector2& r);
FVector2& operator/(const FVector2& r);
FVector2& operator+=(const FVector2& r);
FVector2& operator-=(const FVector2& r);
FVector2& operator*=(const FVector2& r);
FVector2& operator/=(const FVector2& r);
// Operator Overloading - float
bool operator>(const float& r);
bool operator<(const float& r);
bool operator==(const float& r);
bool operator>=(const float& r);
bool operator<=(const float& r);
bool operator!=(const float& r);
FVector2& operator=(const float& r);
FVector2& operator+(const float& r);
FVector2& operator-(const float& r);
FVector2& operator*(const float& r);
FVector2& operator/(const float& r);
FVector2& operator+=(const float& r);
FVector2& operator-=(const float& r);
FVector2& operator*=(const float& r);
FVector2& operator/=(const float& r);
// Simple Math
double length();
void normalize();
double distance(const FVector2 r);
// Advanced Math
void rotate(const double )
// Serialization
const char* serialize();
static FVector2& deserialize(const char* serialized);
};
DLL_METHOD FVector2* DLL_CALL BU_FVector2_Create();
DLL_METHOD FVector2* DLL_CALL BU_FVector2_Copy(FVector2* copyVector);
DLL_METHOD void DLL_CALL BU_FVector2_Destroy();
DLL_METHOD FVector2* DLL_CALL BU_FVector2_TempCreate();
DLL_METHOD FVector2* DLL_CALL BU_FVector2_TempCopy(FVector2* copyVector);
DLL_METHOD void DLL_CALL BU_FVector2_SetTemp(FVector2* vector);
DLL_METHOD void DLL_CALL BU_FVector2_UnsetTemp(FVector2* vector);
DLL_METHOD void DLL_CALL BU_FVector2_TempCleanup();
DLL_METHOD float DLL_CALL BU_FVector2_Length(FVector2* vector);
DLL_METHOD float DLL_CALL BU_FVector2_Normalize();
DLL_METHOD float DLL_CALL BU_FVector2_Distance(FVector2* vector);
DLL_METHOD float DLL_CALL BU_FVector2_DistanceL(float X, float Y);
*/
+166 -166
View File
@@ -1,167 +1,167 @@
// Blitz - Steam wrapper for Blitz.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Long.h"
DLL_FUNCTION(int64_t*) BU_Long_New() {
return new int64_t;
}
DLL_FUNCTION(int64_t*) BU_Long_Copy(int64_t* pOther) {
return new int64_t(*pOther);
}
DLL_FUNCTION(void) BU_Long_Destroy(int64_t* pThis) {
delete pThis;
}
char* BU_Long_Buffer = new char[32];
DLL_FUNCTION(const char*) BU_Long_ToString(int64_t* pThis) {
std::stringstream myStream;
myStream << (*pThis);
const char* myBuffer = myStream.str().c_str();
strcpy_s(BU_Long_Buffer, 32, myBuffer);
return BU_Long_Buffer;
}
DLL_FUNCTION(int64_t*) BU_Long_FromString(const char* pString) {
int64_t* pThis = new int64_t;
std::stringstream myStream = std::stringstream(pString);
myStream >> *pThis;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_FromI(int32_t iRight) {
return new int64_t(iRight);
}
DLL_FUNCTION(int64_t*) BU_Long_FromII(int32_t iLeft, int32_t iRight) {
return new int64_t(((int64_t)(iLeft) << 32) + iRight);
}
DLL_FUNCTION(int32_t) BU_Long_ToI(int64_t* pThis, int32_t iShift) {
if (iShift >= 0)
return (int32_t)(*pThis >> iShift);
else
return (int32_t)(*pThis << -iShift);
}
DLL_FUNCTION(int32_t) BU_Long_ToIH(int64_t* pThis) {
return (int32_t)(*pThis >> 32);
}
DLL_FUNCTION(int32_t) BU_Long_ToIL(int64_t* pThis) {
return (int32_t)*pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_FromF(float_t fOther) {
return new int64_t((int64_t)fOther);
}
DLL_FUNCTION(float_t) BU_Long_ToF(int64_t* pThis) {
return (float_t)*pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_FromD(double_t* pOther) {
return new int64_t((int64_t)*pOther);
}
DLL_FUNCTION(double_t*) BU_Long_ToD(int64_t* pThis) {
return new double_t((double_t)*pThis);
}
DLL_FUNCTION(int32_t) BU_Long_Compare(int64_t* pThis, int64_t* pOther) {
return /* It can either be Equal (0) or Smaller or Greater. Easy to check. */
/* Greater */
(*pThis > *pOther ? 1 : 0) +
/* Smaller */
(*pThis < *pOther ? -1 : 0);
}
DLL_FUNCTION(int64_t*) BU_Long_Set(int64_t* pThis, int64_t* pOther) {
*pThis = *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_Add(int64_t* pThis, int64_t* pOther) {
*pThis += *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_Sub(int64_t* pThis, int64_t* pOther) {
*pThis -= *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_Div(int64_t* pThis, int64_t* pOther) {
*pThis /= *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_Mul(int64_t* pThis, int64_t* pOther) {
*pThis *= *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_Mod(int64_t* pThis, int64_t* pOther) {
*pThis %= *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_SetI(int64_t* pThis, int32_t iRight) {
*pThis = iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_AddI(int64_t* pThis, int32_t iRight) {
*pThis += iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_SubI(int64_t* pThis, int32_t iRight) {
*pThis -= iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_DivI(int64_t* pThis, int32_t iRight) {
*pThis /= iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_MulI(int64_t* pThis, int32_t iRight) {
*pThis *= iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_ModI(int64_t* pThis, int32_t iRight) {
*pThis %= iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_SetII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis = (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_AddII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis += (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_SubII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis -= (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_DivII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis /= (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_MulII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis *= (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_ModII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis %= (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_Shift(int64_t* pThis, int32_t iRight) {
if (iRight >= 0)
*pThis >>= iRight;
else
*pThis <<= -iRight;
return pThis;
// Blitz - Steam wrapper for Blitz.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Long.h"
DLL_FUNCTION(int64_t*) BU_Long_New() {
return new int64_t;
}
DLL_FUNCTION(int64_t*) BU_Long_Copy(int64_t* pOther) {
return new int64_t(*pOther);
}
DLL_FUNCTION(void) BU_Long_Destroy(int64_t* pThis) {
delete pThis;
}
char* BU_Long_Buffer = new char[32];
DLL_FUNCTION(const char*) BU_Long_ToString(int64_t* pThis) {
std::stringstream myStream;
myStream << (*pThis);
const char* myBuffer = myStream.str().c_str();
strcpy_s(BU_Long_Buffer, 32, myBuffer);
return BU_Long_Buffer;
}
DLL_FUNCTION(int64_t*) BU_Long_FromString(const char* pString) {
int64_t* pThis = new int64_t;
std::stringstream myStream = std::stringstream(pString);
myStream >> *pThis;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_FromI(int32_t iRight) {
return new int64_t(iRight);
}
DLL_FUNCTION(int64_t*) BU_Long_FromII(int32_t iLeft, int32_t iRight) {
return new int64_t(((int64_t)(iLeft) << 32) + iRight);
}
DLL_FUNCTION(int32_t) BU_Long_ToI(int64_t* pThis, int32_t iShift) {
if (iShift >= 0)
return (int32_t)(*pThis >> iShift);
else
return (int32_t)(*pThis << -iShift);
}
DLL_FUNCTION(int32_t) BU_Long_ToIH(int64_t* pThis) {
return (int32_t)(*pThis >> 32);
}
DLL_FUNCTION(int32_t) BU_Long_ToIL(int64_t* pThis) {
return (int32_t)*pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_FromF(float_t fOther) {
return new int64_t((int64_t)fOther);
}
DLL_FUNCTION(float_t) BU_Long_ToF(int64_t* pThis) {
return (float_t)*pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_FromD(double_t* pOther) {
return new int64_t((int64_t)*pOther);
}
DLL_FUNCTION(double_t*) BU_Long_ToD(int64_t* pThis) {
return new double_t((double_t)*pThis);
}
DLL_FUNCTION(int32_t) BU_Long_Compare(int64_t* pThis, int64_t* pOther) {
return /* It can either be Equal (0) or Smaller or Greater. Easy to check. */
/* Greater */
(*pThis > *pOther ? 1 : 0) +
/* Smaller */
(*pThis < *pOther ? -1 : 0);
}
DLL_FUNCTION(int64_t*) BU_Long_Set(int64_t* pThis, int64_t* pOther) {
*pThis = *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_Add(int64_t* pThis, int64_t* pOther) {
*pThis += *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_Sub(int64_t* pThis, int64_t* pOther) {
*pThis -= *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_Div(int64_t* pThis, int64_t* pOther) {
*pThis /= *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_Mul(int64_t* pThis, int64_t* pOther) {
*pThis *= *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_Mod(int64_t* pThis, int64_t* pOther) {
*pThis %= *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_SetI(int64_t* pThis, int32_t iRight) {
*pThis = iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_AddI(int64_t* pThis, int32_t iRight) {
*pThis += iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_SubI(int64_t* pThis, int32_t iRight) {
*pThis -= iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_DivI(int64_t* pThis, int32_t iRight) {
*pThis /= iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_MulI(int64_t* pThis, int32_t iRight) {
*pThis *= iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_ModI(int64_t* pThis, int32_t iRight) {
*pThis %= iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_SetII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis = (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_AddII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis += (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_SubII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis -= (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_DivII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis /= (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_MulII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis *= (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_ModII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis %= (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BU_Long_Shift(int64_t* pThis, int32_t iRight) {
if (iRight >= 0)
*pThis >>= iRight;
else
*pThis <<= -iRight;
return pThis;
}
+62 -62
View File
@@ -1,63 +1,63 @@
// Blitz - Steam wrapper for Blitz.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "BlitzUtility.h"
#include <sstream>
DLL_FUNCTION(int64_t*) BU_Long_New();
DLL_FUNCTION(int64_t*) BU_Long_Copy(int64_t* pRight);
DLL_FUNCTION(void) BU_Long_Destroy(int64_t* pThis);
DLL_FUNCTION(const char*) BU_Long_ToString(int64_t* pThis);
DLL_FUNCTION(int64_t*) BU_Long_FromString(const char* pString);
DLL_FUNCTION(int64_t*) BU_Long_FromI(int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_FromII(int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int32_t) BU_Long_ToI(int64_t* pThis, int32_t iShift);
DLL_FUNCTION(int32_t) BU_Long_ToIH(int64_t* pThis);
DLL_FUNCTION(int32_t) BU_Long_ToIL(int64_t* pThis);
DLL_FUNCTION(int64_t*) BU_Long_FromF(float_t fOther);
DLL_FUNCTION(float_t) BU_Long_ToF(int64_t* pThis);
DLL_FUNCTION(int64_t*) BU_Long_FromD(double_t* pOther);
DLL_FUNCTION(double_t*) BU_Long_ToD(int64_t* pThis);
DLL_FUNCTION(int32_t) BU_Long_Compare(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Long_Set(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Long_Add(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Long_Sub(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Long_Div(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Long_Mul(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Long_Mod(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Long_SetI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_AddI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_SubI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_DivI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_MulI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_ModI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_SetII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_AddII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_SubII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_DivII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_MulII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_ModII(int64_t* pThis, int32_t iLeft, int32_t iRight);
// Blitz - Steam wrapper for Blitz.
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include "BlitzUtility.h"
#include <sstream>
DLL_FUNCTION(int64_t*) BU_Long_New();
DLL_FUNCTION(int64_t*) BU_Long_Copy(int64_t* pRight);
DLL_FUNCTION(void) BU_Long_Destroy(int64_t* pThis);
DLL_FUNCTION(const char*) BU_Long_ToString(int64_t* pThis);
DLL_FUNCTION(int64_t*) BU_Long_FromString(const char* pString);
DLL_FUNCTION(int64_t*) BU_Long_FromI(int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_FromII(int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int32_t) BU_Long_ToI(int64_t* pThis, int32_t iShift);
DLL_FUNCTION(int32_t) BU_Long_ToIH(int64_t* pThis);
DLL_FUNCTION(int32_t) BU_Long_ToIL(int64_t* pThis);
DLL_FUNCTION(int64_t*) BU_Long_FromF(float_t fOther);
DLL_FUNCTION(float_t) BU_Long_ToF(int64_t* pThis);
DLL_FUNCTION(int64_t*) BU_Long_FromD(double_t* pOther);
DLL_FUNCTION(double_t*) BU_Long_ToD(int64_t* pThis);
DLL_FUNCTION(int32_t) BU_Long_Compare(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Long_Set(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Long_Add(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Long_Sub(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Long_Div(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Long_Mul(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Long_Mod(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BU_Long_SetI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_AddI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_SubI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_DivI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_MulI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_ModI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_SetII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_AddII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_SubII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_DivII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_MulII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_ModII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BU_Long_Shift(int64_t* pThis, int32_t iShift);