1
General / Questions regarding C++, learning to use the language correctly.
« on: March 21, 2013, 11:53:47 pm »
After learning SFML and playing around with it for just over a year, I've been making my own mini engine for me to use to make basic games. Even though it works well, I feel its extremely poorly programmed, I see a lot of people saying that manual memory allocation (= new object) is terrible and you should never use it.
I use it ALOT, so I feel its about the right time to change my ways and learn to program correctly. I feel as though uploading the code I've created so far would be the smart option so you can all see how and where I've gone wrong but I'm not really sure the best method.
Link to my git: https://github.com/ChrisMelling/basicGame
The way I went about the design was. Each GameState knows of the application class and methods to access its information then each Entity knows about the state it was created in, so therefore the entities are able to access practically all methods in the game, all the back to the Application class.
This seem'd to make sense in my head but you're all about too rip it to shreds but I welcome it with open learning arms.
Edit: I fear I'm going to be shouted at a lot for doing this, but how terrible is it to use reinterpret_cast/dymanic_cast?
I use it ALOT, so I feel its about the right time to change my ways and learn to program correctly. I feel as though uploading the code I've created so far would be the smart option so you can all see how and where I've gone wrong but I'm not really sure the best method.
Link to my git: https://github.com/ChrisMelling/basicGame
The way I went about the design was. Each GameState knows of the application class and methods to access its information then each Entity knows about the state it was created in, so therefore the entities are able to access practically all methods in the game, all the back to the Application class.
This seem'd to make sense in my head but you're all about too rip it to shreds but I welcome it with open learning arms.
Edit: I fear I'm going to be shouted at a lot for doing this, but how terrible is it to use reinterpret_cast/dymanic_cast?