Skip to main content
gamedev.net
🔒 Locked

Game Singleton?

Started by Neen10do Apr 27, 2003 at 9:18 PM 1 replies 400+ views
Original Post
Neen10do
Neen10do
should the game itself be its own class that the main.cpp creates and calls? or should the game be created in the main.cpp because there would only be one of them anyway? ---------------------- i code therefore i am. Aero DX - Coming to a bored Monitor near you!
----------------------i code therefore i am.Aero DX - Coming to a bored Monitor near you!
matthias6S
matthias6S
If you desire an OO concept, encapsulation should be applied wherever possible. This also seperates the game code from the system code. I prefer to split the game into several gamestates (intro, menu, game, ...) which are managed by a gamemanager class which I usually implement as a Singleton. But finally, the right approach depends on the size of your project. If you are going to write a simple number guessing console game, it probably wouldn''t be worth the effort.

Regards
Matt

Lead programmer at sechsta sinn - http://www.sechsta-sinn.com - mailto:matthias@sechsta-sinn.com
davepermen
davepermen
i see no point in the singleton. just create it in the main function, and done.

"take a look around" - limp bizkit
www.google.com
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia
My Page davepermen.net | My Music on Bandcamp and on Soundcloud

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.