23 #define _CRT_SECURE_NO_WARNINGS 31 static bool sReadFile(
char*& data,
int& size,
const char* filename)
33 FILE* file = fopen(filename,
"rb");
39 fseek(file, 0, SEEK_END);
41 fseek(file, 0, SEEK_SET);
48 data = (
char*)malloc(size + 1);
49 fread(data, size, 1, file);
60 fprintf(file,
" \"testIndex\": %d,\n",
m_testIndex);
63 fprintf(file,
" \"hertz\": %.9g,\n",
m_hertz);
66 fprintf(file,
" \"drawShapes\": %s,\n",
m_drawShapes ?
"true" :
"false");
67 fprintf(file,
" \"drawJoints\": %s,\n",
m_drawJoints ?
"true" :
"false");
68 fprintf(file,
" \"drawAABBs\": %s,\n",
m_drawAABBs ?
"true" :
"false");
73 fprintf(file,
" \"drawCOMs\": %s,\n",
m_drawCOMs ?
"true" :
"false");
74 fprintf(file,
" \"drawStats\": %s,\n",
m_drawStats ?
"true" :
"false");
75 fprintf(file,
" \"drawProfile\": %s,\n",
m_drawProfile ?
"true" :
"false");
79 fprintf(file,
" \"enableSleep\": %s\n",
m_enableSleep ?
"true" :
"false");
102 for (
int i = 0; i < fieldCount; ++i)
107 if (strncmp(fieldName.
data(),
"testIndex", fieldName.
length()) == 0)
116 if (strncmp(fieldName.
data(),
"windowWidth", fieldName.
length()) == 0)
125 if (strncmp(fieldName.
data(),
"windowHeight", fieldName.
length()) == 0)
134 if (strncmp(fieldName.
data(),
"hertz", fieldName.
length()) == 0)
143 if (strncmp(fieldName.
data(),
"velocityIterations", fieldName.
length()) == 0)
152 if (strncmp(fieldName.
data(),
"positionIterations", fieldName.
length()) == 0)
161 if (strncmp(fieldName.
data(),
"drawShapes", fieldName.
length()) == 0)
bool m_drawFrictionImpulse
static const char * fileName
int get_integer_value() const
const char * data() const
static bool sReadFile(char *&data, int &size, const char *filename)
size_t get_length() const
string get_object_key(size_t index) const
bool m_drawContactNormals
value get_root() const
If is_valid(), returns the document's root value.
bool m_drawContactImpulse
bool m_enableWarmStarting
value get_object_value(size_t index) const
double get_number_value() const
type get_type() const
Returns the JSON value's type.
document parse(const AllocationStrategy &strategy, const StringType &string)