approachcircle / Pong

a pong game written in LibGDX
GNU General Public License v3.0
1 stars 1 forks source link

inject `Game` instance into every `Screen` #3

Closed approachcircle closed 9 months ago

approachcircle commented 9 months ago

this will remove the need for the singleton pattern that's present on Game removing the need to call Game.getInstance().setCurrentScreen() and instead we can just access the Game instance that has been injected. Renderables that need access to the Game instance can just have it injected into them through their respective Screen instance also, opposed to accessing the singleton instance.

approachcircle commented 9 months ago

not a good idea, a singleton pattern in java is better than dependency injection in this situation it seems