zngaa, just, thanks.
I've been thinking here at work about making the separation you mention and you just made it very clear and simple, thanks!
But about the GUI itself, I need a bit more of help:
- First, is it ok to do it as I did? One picture loaded into the sprite field of an entity? What if I need to show some numbers, should all be entities and sprites?
This should be fine for your entities, if you need to show numbers just include that in their render methods
- Why do I need to make sure it has alpha support?
Using the way I suggested you would be drawing the game render first, then drawing an image representing the gui on top of the game render, if there isn't alpha support on that image it will simply cover up the game render. Which is no good, you want people to see the game render, haha!
- What about the game menu? Should I do it with JPanel?? How do I use custom background and buttons then? Any insight would be very much apreciated.
What I do is create game states, one for the menu another for the game. Something like this:
(pseudo code)
game state class
>init method
>>put all your initialization code here, does the state need access to images (sprites) or other system files, does it need to set up any specific output settings? Put all that here
>render method
>>put all the drawing stuff here
>enter method
>>call this method every time your changing from ANOTHER state to this state, if any settings need to be reset, this is where that happens
>leave method
>>call this method any time your changing from THIS state to another state
game loop
>update current state
>render current state
...
>sleep
I modify this post later to add in some code, but I am really busy now... about an hour.