PHP Code:
char szBuffer[50];
RECT rec = initRecArea(r.left, r.top, screenWidth, screenHeight);
GetClientRect(hWnd, &rec);
screenWidth = (rec.right - rec.left);
This code gets the rectangular area of our parent window which is hWnd.
Width is then calculated by by getting the difference from the right side of the rectangle to the left side.
PHP Code:
_stprintf_s(szBuffer,"Player: %i Computer: %i\n", playerScore, compScore);
We put the scores into the buffer and player & comp scores are globally defined. The values change accordingly as well so the computation is correct when the paddle scores.
PHP Code:
SetBkMode( hdc, TRANSPARENT );
This piece of code simply tells the application to render the text on the background as opposed to it's default background which is white.
PHP Code:
TextOut(hdc, (screenWidth / 2), 0, szBuffer, sizeof(szBuffer));
Here is the function on MSDN: http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
The 2nd parameter is the x value (location on screen), so naturally it should be
(screenWidth / 2) - string length
Although this doesn't seem to work, and I'm not sure why. I will go ahead and try SetTextAlign().
EDIT:
SetTextAlign() doesn't seem to work for me either I'll have to take a different approach.