0

I am trying to make my second java game (2D) but i have run in a problem: The game will be in fullscreen, but how can i make it so it is scaled properly for each screen? While researching i found out that (almost) everyone is saying the same thing: render it on a Buffered image first and then render the image on the screen resolution, which i understund how to do ( BufferedImage i = new BufferedImage(width, height, 1); BufferStrategy bs = this.getBufferStrategy();

    Graphics2D g2 = i.createGraphics();
    if(bs == null){
        this.createBufferStrategy(3);
        return;
    }

    Graphics g = bs.getDrawGraphics();
    //g2.draw....

    g.dispose();
    bs.show();

) but wont that make everything look squeezed or streched? P.s. if you know any way of making it scale only by keeping the starting resolution (leaving black on both sides) i would accept it

P.s.Sorry for my english.Hope i explained it good enough (if not ask me to clarify)

Feconiz
  • 39
  • 9
  • 1
    In theory, something like [this](http://stackoverflow.com/questions/11959758/java-maintaining-aspect-ratio-of-jpanel-background-image/11959928#11959928). You need to know what the "original" size of the game is (so 1:1), from there you can calculate how best to resize it and then you could scale just the `Graphics` context directly before you raw anything to it – MadProgrammer Apr 25 '16 at 21:46
  • @MadProgrammer Thank you that actually helps alot :D – Feconiz Apr 25 '16 at 21:57

0 Answers0