This is the part I struggle the most while making a game.
Let's say I decide to create an RTS, right? So I'm making the classes like Unit, Villager : public Unit, Bowman : public Unit, etc etc. I got that. And you do it with other things too (buildings, resources on map), but then you get the daunting task to add it all together.
Then you need to add your variables like gold, wood, stone, etc.. But where? And then where do you connect all of them together? In main?
This seems like SO MUCH stuff is going into one file.. I refuse to believe this is how you do it for big projects.
And lastly, how does a menu fit into this? Should all of this be inside one main function? I have to keep restarting projects that get too big because it just all gets confusing..
So I guess my question is this: how do you organize everything together for a game? (I'm using SFML 2, but I'd think this would be for all types/libraries).
Most people have a MyClass.hpp&MyClass.cpp files for each class, and in the main function is is usually as simple as creating an instance of the game class and invoking e.g. game.play().
Generally the game class will be the link. Specific menus will be instances or classes that extend a base menu class, and you can enter a menu, then back out of it to then go into the actual gameplay. Thinks like resources are associated with the player, so they stay with the player class, and then are displayed by the UI class.