I've written a tiny game which i already have created a Swing-Frontend for and now want to make it look cool, via the JMonkeyEngine.
One of my problems is, that I don't grasp the whole concept behind the engine. Somehow there's this Renderer that does most of the stuff, so it needs to be accessible in every single of my graphical components. Well, ok, so I made my subclass of SimpleGame a Singleton that provides anything needed. Most tutorials are very limited (they only use a single class) and thus are not well structured (imho at least). I doubt this singleton approach of making the renderer (and system stuff) available to my graphical components is a best practice. Some advice on that would be appreciated.
Also, in my Swing-Frontend, I have various panels which contain a GameState member (which has nothing to do with Graphics, but just keeps track of the game), which are just made visible or invisible depending on user-interaction and game events. I want to reproduce this the closest possible, so my plan is to create some custom Nodes for every panel I have in Swing, containing the necessary GameState, GameEventHandling interface and the graphical components. What do you think about that?
At the moment I am trying create a QuadComponent that automatically keeps track of itself and changes textures when its state change. By "state" I mean something defined in the logic of the game, which will be a member variable of the QuadComponent. Now I can't find the proper way for the quad to keep track of itself, e.g. change its texture, recognize mouse-intersection asf. I don't want to do this in some global context (like in the game class), but rather locally for every graphical component. Can you please hint me on how to do that? Sample code would be great!
I hope you understand my "not so poor but yet not good enough"-english and have a good day,
For better understanding, here is some pseudocode of what I want to achieve:
public class QuadComponent extends Quad implements MouseIntersectionListener
public void onMouseIntersection(MouseIntersectionEvent evt)
//set another texture here