'speed' is a scalar quantity (it is just a magnitude), what you are talking about is 'velocity', which is a vector quantity because it has both a magnitude and a direction. It's a minor technical point
I think your Force formula should be like this:
F = (constant * m1*m2)/radius2;
and you're also not squaring your radius in your code so it should be like:
xforce = (grav* body1.mass * body2.mass) / xradius2;
yforce = (grav * body1.mass * body2.mass) / yradius2;
Good job! It looks really amazing!
BTW, I think there's a bug when closing the window. Perhaps you can stop your loop or timer for drawing when a WM_CLOSE or WM_DESTORY message is sent to your window?
You should create a background thread to do the drawing, else the app can only be closed with Ctrl+Alt+Del. Or use PeekMessage instead of GetMessage and use idle time for drawing.
All the buzzt CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.