Best practice - Node design


Hey all

I was wondering what the best practice was in order to initialize and handle nodes, heareby I mean renderstates, controllers, etc.

I'll try to post afew questions


  • Should I pass a display to each of my nodes or should I use DisplaySystem.getDisplaySystem(), the latter requires that a display is running 

  • Should i try to init all my stuff in the constructor of a node or create an init method instead?




It's really up to you how you implement them.



I extend Node then have an init method that instantiates my member variables that are not public static final.



As for DisplaySystem.getDisplaySystem().  The display is running… you don't have a choice.  I don't pass the DisplaySystem around, if I can help it.  Since I use GameStates, I don't worry about the DisplaySystem.  If I have a method that requires use of DisplaySystem then I implicitly ask for the DisplaySystem.



Some do pass it around, I do not.



timo