Hey guys, I am pretty clueless with how GUI stuff really works but I had gotten it working for my game so far…Thing is I want to be able to make it so that when I resize the window all of my graphics and all resize along with it…Is there like a standard way of going about this?
Heres all my JFrame stuff
JFrame frame;
setMinimumSize(new Dimension(256, 224));
setMaximumSize(new Dimension(500, 500));
setPreferredSize(new Dimension(256, 224));
frame = new JFrame("2DGAME");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
frame.add(this, BorderLayout.CENTER);
frame.pack();
frame.setResizable(true);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
And Here is my main Render method
public void render(){
BufferStrategy bs = getBufferStrategy();
if(bs==null){
createBufferStrategy(3);
return;
}
Graphics g= bs.getDrawGraphics();
//this is where you draw.
stateStack.render(g);
for(Entity e:GamePlayState.entities)
e.Render(g);
bs.show();
g.dispose();
}