Can I use a traditional "game loop" with Cinder instead of the default draw() and update() functions?

After working with @paul.houx on a project a while back and using his fixed timestep setup, I created a class that does this, which I’ve since used in just about every project I’ve worked on:

Supports a couple nice things like pausing, seeking time, and disabling fixed timestep. Use it like this:


// in class declaration:
ma::WorldClock		mWorldClock;

void YourApp::setup()
{
	mWorldClock.getSignalClockStep().connect( signals::slot( this, &YourApp::updateScene ) );
}

void YourApp::update()
{
     mWorldClock.update( ci::app::getElapsedSeconds() );
}

void YourApp::updateScene()
{
	if( mScene ) {
		mScene->update();
	}

}

Thanks Paul. :slight_smile:

3 Likes