I want to know How could I draw a String or Rectangle (the JFrame is in a full screen completely)
Heres what in my Main.java class:
public static int WIDTH, HEIGHT;
private Window window;
...
public Main() {
window = new Window("2D Shooter", this);
...
private void render(){
BufferStrategy bs = this.getBufferStrategy();
if(bs == null){
this.createBufferStrategy(3);
return;
}
Graphics g = bs.getDrawGraphics();
g.setColor(Color.BLACK);
g.fillRect(0, 0, WIDTH, HEIGHT);
handler.render(g);//this calls the render method to render objects
g.dispose();
bs.show();
}
Later in a different class I have:
public void render(Graphics g){
...
g.setColor(Color.WHITE);
g.drawString("2D Shooter", ((Main.WIDTH)/2), (Main.HEIGHT/5));
...
}
This Code Works and runs BUT the text is not completely centered I want it to be Centered on top not in the middle. Thank You!