it's just my style. i don't know if it's faster.

code:
vec_set(dir,nullvector);
if(key_a)
{
dir.x-=1;
}
if(key_d)
{
dir.x+=1;
}

the reason i did it this way is that when the user presses a and d at the same time dir.x should be 0. i think it's more elegant than with an additional if statement.

btw. i forgot to time correct the force applied to the ball. the vec_normalize line should be something like that:
vec_normalize(dir,50*time);