LNXSDK/lib/haxebullet/bullet/btCustomArray.h

79 lines
811 B
C
Raw Permalink Normal View History

2025-01-22 16:18:30 +01:00
#include <stdlib.h>
class btFloatArray {
int count = 0;
public:
float *raw;
btFloatArray(int num) {
raw = (float *) malloc(sizeof(float) * num);
count = num;
}
~btFloatArray() {
free(raw);
}
float at(int pos) {
return raw[pos];
}
int set(int pos, float value) {
if(pos < count){
raw[pos] = value;
return 0;
}
return 1;
}
int size() {
return count;
}
};
class btIntArray {
int count = 0;
public:
int *raw;
btIntArray(int num) {
raw = (int *) malloc(sizeof(int) * num);
count = num;
}
~btIntArray() {
free(raw);
}
float at(int pos) {
return raw[pos];
}
int set(int pos, int value) {
if(pos < count){
raw[pos] = value;
return 0;
}
return 1;
}
int size() {
return count;
}
};