-
Notifications
You must be signed in to change notification settings - Fork 0
/
Settings.cpp
35 lines (30 loc) · 1.83 KB
/
Settings.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "Settings.h"
#include "Game.h"
Settings settings;
void Settings::Init()
{
velocityIteration = 40;
positionIteration = 5;
stepIteration = 30;
frictionSwitch = true;
gravity = 9.8;
pause = false;
this->InitAntTweakBar();
}
void Settings::InitAntTweakBar()
{
TwBar *bar = TwNewBar("bar_settings");
TwDefine("bar_settings label='Settings' refresh=0.01 size='240 300'");
TwDefine(" GLOBAL help='A Simple Physics Engine Demo\nYuanming Hu'");
TwAddVarRW(bar, "velocityIter", TW_TYPE_INT32, &velocityIteration, " label='Velocity Iterations' min=0 max=80 step=1 group='Iterations'");
TwAddVarRW(bar, "positionIter", TW_TYPE_INT32, &positionIteration, " label='Position Iterations' min=0 max=20 step=1 group='Iterations'");
TwAddVarRW(bar, "stepIter", TW_TYPE_INT32, &stepIteration, " label='Step Iterations' min=1 max=50 step=1 group='Iterations'");
TwAddVarRW(bar, "fricSwitch", TW_TYPE_BOOLCPP, &frictionSwitch, " label='Friction' group='World Properties'");
TwAddVarRW(bar, "pause", TW_TYPE_BOOLCPP, &pause, " label='Pause' group='World Properties'");
TwAddVarRW(bar, "gravity", TW_TYPE_DOUBLE, &gravity, " label='Gravity' min=-10 max=10 step=0.5 group='World Properties'");
TwAddVarRO(bar, "frameRate", TW_TYPE_INT32, &frameRate, " label='Frames Per Second' group='Information'");
TwAddVarCB(bar, "numObjects", TW_TYPE_UINT32, NULL, Physics::GetObjectNumberTW, &game.physics, " label='Objects' group='Information'");
TwAddVarCB(bar, "numShapes", TW_TYPE_UINT32, NULL, Physics::GetShapeNumberTW, &game.physics, " label='Shapes' group='Information'");
TwAddVarCB(bar, "numForces", TW_TYPE_UINT32, NULL, Physics::GetForceNumberTW, &game.physics, " label='Forces' group='Information'");
TwAddVarCB(bar, "numConstraints", TW_TYPE_UINT32, NULL, Physics::GetConstConstraintNumberTW, &game.physics, " label='Constraints' group='Information'");
}