Timeline for Game class and main function
Current License: CC BY-SA 3.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| S Aug 6, 2013 at 13:10 | history | suggested | CommunityBot | CC BY-SA 3.0 | return 0 in main() |
| Aug 6, 2013 at 10:44 | review | Suggested edits | |||
| S Aug 6, 2013 at 13:10 | |||||
| Mar 10, 2012 at 9:27 | vote | accept | David Gomes | ||
| Mar 10, 2012 at 6:37 | comment | added | Matt Jensen | If you do build a larger game, it is nice to have a soft reset function, it makes things a lot better user experience wise, and for some games you just can't just deconstruct and reconstruct the game class. Say that you do all your set-up and initialization in the game class, then its a time problem, what if your game class controls your menu system, do you really want the game to restart just because you want to exit the current game type? This completely depends on the design of your game, but adding core functions is better now than later. | |
| Mar 10, 2012 at 4:15 | history | edited | David Gouveia | CC BY-SA 3.0 | No point being virtual when private. |
| Mar 10, 2012 at 0:14 | comment | added | Patrick Hughes | @user1083855 not all games are huge monstrosities, many are small and simply deleting the entire game object and rebuilding it is far easier than writing a Reset() method and hoping that you remembered to reset and clear all the states. So it's both faster to write and no debugging required. Even some large games do this with engine systems like maps every time you transition or quit to the main menu so it's really just a matter of how much is torn down and rebuilt and not whether it's a bad idea or not. | |
| Mar 9, 2012 at 23:48 | comment | added | tigrou | I agree for exception (catched in main()) function). But why would you want to destroy and recreate whole game ? (thus also main SDL window ?). Not sure to understand. | |
| Mar 9, 2012 at 23:40 | comment | added | Patrick Hughes | This is typically how it's done. It makes it easier to provide a good place for a last-chance exception catch, plus you can now destroy your game and recreate it easily. | |
| Mar 9, 2012 at 23:18 | history | edited | David Gouveia | CC BY-SA 3.0 | added 887 characters in body |
| Mar 9, 2012 at 23:12 | history | edited | David Gouveia | CC BY-SA 3.0 | added 887 characters in body |
| Mar 9, 2012 at 22:54 | history | answered | David Gouveia | CC BY-SA 3.0 |