Thursday, July 09, 2009

Bouncing the list

While I was preparing the code for the next post, I realized that something really important is missing from the touch list: it does not "bounce". Use the sample I published in the last post and try to move the list. It will not budge. Similar implementations allow you to move the list out of it's stable position (minimal energy position?) and it will move back to where it was. It gives you a nice sense that you are dealing with a physical inertial entity.

The sample code I'm publishing today just allows for this and simply resets the list to it's stable position without any animation or kinematic feedback. Right now I'm going through some high-school kinematic equations in order to implement some properly accelerated animations to the list. Meanwhile, check the source code here: As you can see, the list painting now allows for empty space both before and after the list so that when you force it down it will not leave garbage at the top.


vincent said...


When trying to compile it I get :

c:\documents and settings\vincent\bureau\crypsafe02\wmfw\Gps.h(3) : fatal error C1083: Cannot open include file: 'CriticalSection.h': No such file or directory

Is is a standard include from wtl or a user defined ?

João Paulo Figueira said...

Just plain stupidity from my side... I was warned that this file was missing but forgot to include it. Of course, everything works OK on my machine...

You can get it here.