SFML community forums
Help => General => Topic started by: jh1997sa on February 21, 2013, 08:25:06 pm
-
Hey,
I'm very new to C++ and SFML. I've been programming in Java for a few months now but I only started C++ (and SFML) yesterday.
Anyway, I'm creating the hello world of game development, Pong.
If someone could just go through this code and check if there's anything significant which I could improve, it would be much appreciated!
GitHub link: https://github.com/jh1997sa/Game-Development
-
For one of your first application/games with C++ and SFML, your code is extremely good! :)
Clean interfaces and nicely organized code, if only everyone would start off that way... ;)
Here are a few suggestions, how you can make your code even so slightly better:
- Use SFML 2 - see here (https://github.com/SFML/SFML/wiki/FAQ#wiki-grl-version) for more information.
- Pack your code from main.cpp also into a class, e.g. Application or Game, and only create an instance of the new class in the main function. (Similar on how'd go about in Java, just with main part outside of any class.)
- The one-line if statement bodies in Paddle::input could need some indentation, so the flow gets clearer.
Other than that I can't really critics more, then again the codebase is rather small so eventual design issues, might only become clear in the future.
-
Well I've made a few simple games with Java so I guess that helps.
Oh and I'm the guy who was on the IRC channel earlier trying to get SFML 2 to work. Anyway I've got it working now so I'll rewrite it using SFML 2 and, well, finish the game.
Thanks for your reply!