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");
101 int fieldCount = int(
root.get_length());
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)