Currently, I have a couple of static objects that I need to access from multiple other classes.
public static OrthographicCamera camera;
public static World world;
public static Player player;
public static TouchpadHandler touchpad;
It just doesn't feel clean or correct to repeatably access those from the other class, like this:
MainClass.world.blabla();
I've tried PASSING a reference to the desired object in a new instance's constructor. Something like this: (just an example)
... MainClass.java
OtherClassINeed obj = new OtherClassINeed(world);
... OtherClassINeed.java
private World world;
public OtherClassINeed(World world){
this.world = world;
}
But this seems like it would be incredibly annoying/inefficient once you start needing multiple things (like the 4 shown above).
So I'm wondering: what's the best way to handle such a thing? Thank you!