Hi, im making a GUI library(It’s in the veeeery early stages) for general purposes(My own 3D game in JME3 and the games i do on my job(JApplets browser games)) and i want it to be able to comunicate to JME3.
As i can guess, all i need to do is to make a node draw a image under “ortogonalNode”(actualy i don’t remember the correct name, it was something like that, it’s a field from SimpleApplication), so i can make a GUI.
If that is correct then i still need help with two issues:
First:
Connecting my GUI library to JME3. My library will have a class named Connection that will manage some things, right now only two of them have been made, a class that get BufferedImages to be able to draw the components from the library, and a GraphicsConnection that will make the communication betwen JME3 and the GUI library. Seens that i can’t post anexes so i will post the whole class later on this thread.
The communication idea:
GraphicsConnection have two fields:
- Graphics2D dbg: Every component is drawn here, you need to be able to render it, either by creating it from a image and drawning the image afterwards, or with something else.
- Container scene: The current scene to be drawn, you add a couple of components(or other containers) inside this container and the GraphicsConnection will draw them during the draw method.
It also contains 3 important methods:
- void Update(long diftime): Update the state of all components inside the current scene with the given time diference betwen this call and the last call of this method(you suply the value, in case you need it to go fast foward for some reason), things like buttons will need this method to be able to animate the “you clicked on me” annimation.
- Graphics2D draw(Graphics2D): This method will either draw on it’s own Graphics2D or the one you just supplied, it will always return the Graphics2D it drew on. This method needs to be called often like Update.
- void setScene(Container): Replaces the current scene with a new one, like a transaction betwen item list scene and main menu scene or multiplayer scene or whatever.
With those methods it should be easy to communicate and work with JME3 i supose, im posting them because im not sure and im not very experienced with JME3.
But the biggest problem of all is the ResourceConnection. This one should be able to communicate betwen AssetManager from JME3 and generate a method with given syntax:
public BufferedImage(imagename): This method is called by a lot of components that require a image, like a Pane that will have a cool boarder or something.
Is this ResourceConnection possible to do? how to? Is there a huge problem to the idea that make it not viable? what could be changed to make it possible? (Btw it migth not be worth to make to work with JME3, but it is to work on my job, so i want to be able to use this library for both projects).
Im quite sure it got quite complicated and confused so ask if you need more information to help me…
Thx for the help in advance ;D