Add sleep to avoid 100% busy CPU loop in PhysicsServerExample

Added btClock::usleep
Fix broken TinyRenderer example code.
This commit is contained in:
erwin coumans
2016-08-13 12:21:18 -07:00
parent 238ba8c642
commit 3bdcf23a05
9 changed files with 61 additions and 13 deletions

View File

@@ -107,7 +107,7 @@ static CommonExampleInterface* sCurrentDemo = 0;
static b3AlignedObjectArray<const char*> allNames;
static float gFixedTimeStep = 0;
bool gAllowRetina = true;
bool gDisableDemoSelection = false;
static class ExampleEntries* gAllExamples=0;
bool sUseOpenGL2 = false;
bool drawGUI=true;
@@ -556,9 +556,11 @@ struct MyMenuItemHander :public Gwen::Event::Handler
Gwen::String laa = Gwen::Utility::UnicodeToString(la);
//const char* ha = laa.c_str();
selectDemo(sCurrentHightlighted);
saveCurrentSettings(sCurrentDemoIndex, startFileName);
if (!gDisableDemoSelection )
{
selectDemo(sCurrentHightlighted);
saveCurrentSettings(sCurrentDemoIndex, startFileName);
}
}
void onButtonC(Gwen::Controls::Base* pControl)
{
@@ -580,8 +582,11 @@ struct MyMenuItemHander :public Gwen::Event::Handler
*/
// printf("onKeyReturn ! \n");
selectDemo(sCurrentHightlighted);
saveCurrentSettings(sCurrentDemoIndex, startFileName);
if (!gDisableDemoSelection )
{
selectDemo(sCurrentHightlighted);
saveCurrentSettings(sCurrentDemoIndex, startFileName);
}
}
@@ -1228,5 +1233,6 @@ void OpenGLExampleBrowser::update(float deltaTime)
void OpenGLExampleBrowser::setSharedMemoryInterface(class SharedMemoryInterface* sharedMem)
{
gDisableDemoSelection = true;
sSharedMem = sharedMem;
}