Hi guys,
when I was in school, I learnt that singletons are generally bad practice. Now I got some manager classes that handle my game states, input (game actions) and game related objects like group of enemies, items and animations.
I want to access them in every class (e.g. in a menu state where I need a localized string) but I don’t want to parse my config in each state individually.
My first attempt was (obviously, I guess) a singleton. But the code ends up messy.
My second attempt was a static instance of my configuration in my game class. Is this a “better” practice? My code doesn’t look as messy as with singletons.
Game.colors.getIntegerProperty("font_highlight")
vs
ConfigHandler.getInstance().getConfig("colors").getIntegerProperty("font_highlight")
Is there even a better attempt?
Thanks in advance!