I have a player box2d object on screen, who should be controlled by two buttons, one left, and one right. When you press the right button, the player should move right, but when you press the left button, the player should immediatly stop moving right and move left. This should also happen vice versa.
I tried to do this to move right,
 b2Vec2 impulse(4, 0);
 body->ApplyLinearImpulse(impulse, body->GetWorldCenter());

and this to move left
b2Vec2 impulse(4, 0);
 body->ApplyLinearImpulse(impulse, body->GetWorldCenter());

This works, but when I press right and then left, the player doesn't immediatly go left, but continues right for a while, and then goes left. How do I make sure this doesn't happen?


Question: where to put .sty and .cls file for project
Answer: there is a third possibility and for projects the best one: put all in a texmf directory which is located inside your documents directory. Then do a export TEXMFHOME=texmf before running pdflatex or something else and the texmf tree will be searched first. 

Inside this local texmf you must have the same TeX Directory Structure as usual: http://tug.org/tds For a local texmf tree you do not need to run texhash because files are searched recursively in that tree