where is my logic flawed ??? (making font counter)
Fair enough, but LuckyNewbie''s method is much safer and more robust, as it does not rely on any previous state. Not to mention the fact that it can be used in situations where the score increments by more than one point at a time.
I know the Pong clone is done, but I just wanted to say to LuckyNewbie that the score display algorithm is a pretty smart idea also. I never thought of getting digits recursively, either (based on his aside). Good job!
[edited by - Sluginator on March 4, 2004 6:38:31 PM]
[edited by - Sluginator on March 4, 2004 6:38:31 PM]
I would recommend using a regular integer, and then learning how to use SDL_TTF. SDL_TTF accepts a character array as the display text, so just use the itoa function (found in stdlib.h) to convert the integer to a proper displaying char array. It's rather simple to do, and it is much easier to manage an actual integer for the score.
By the way: Focus on SDL is written in generic C/C++, until the later chapters, where you are given some nice example classes / class concepts.
[edited by - xempest on March 5, 2004 9:31:11 AM]
By the way: Focus on SDL is written in generic C/C++, until the later chapters, where you are given some nice example classes / class concepts.
[edited by - xempest on March 5, 2004 9:31:11 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement