Hi! Thanks for purchasing and reading the book! I'm glad you like it so far.
For the GetWindow() method, you absolutely could use a reference. It actually makes more sense in most cases, unless nullptr is a valid return value, in which case using a pointer would be best. Regarding const correctness, you're absolutely right. That was actually my intention. Shoving everything into one publication just seemed like too much, not to mention it would cause formatting problems every once in a while.
The "l_" prefix stands for local, meaning the argument is local to the function/method. There are better alternatives to using Hungarian notation though, so take that with a grain of salt.
Thanks for the clarification
I'm done with the Chapter "EventManager" now and I really got some new inspirations from this one! Nice work! And btw.:
enum StateType{
Intro = 1, Intro_MainMenu, MainMenu, Game, MainMenu_Game
Paused, GameOver, MainMenu_GameOver, Credits, MainMenu_Credits
...
// Crying in the corner.
};
I had to laugh
Love it when a book is not to strictly serious!
Edit: converting the code using smart pointers is not so hard as I first though...but remember: std::move is your friend ... totally forgot about this at first and wondered what the hell is wrong x_X
Edit2: I am always coding with -Wall compiler flag and encountered some warnings:
- Some class/struct ctor member intializations are in the wrong order (not in the order of their declaration)
- LoadBingings() in the EventManager class =>
int end = keyval.find(delimiter); => changed it to size_t