Chapter2
I am looking at the RenderBall / RenderPaddles methods and trying to get a handle on the numbers. At first they look a little random, was wondering if anyone could explain why they are used?
RenderSprite(gameTexture,
(int)((0.05f + 0.9f * ballPosition.X) * 1024) - GameBallRect.Width/2,
(int)((0.02f + 0.96f * ballPosition.Y) * 768) - GameBallRect.Height/2,
GameBallRect);
Where is 0.05, 0.9, 0.96 coming from? I assume this is adjusting for screen scaling in some way. Normally code would use a constant that describes a number vice using real numbers inside a method.
|