0

I am currently trying to program a simple platform game. I would like to scale the graphics up by a factor of 2/4/whatever so that I can get an old-school look and feel from the game. However, when I call scale on my Graphics2D instance, nothing happens.

@Override
public void paint(Graphics g) {

    BufferStrategy bf = this.getBufferStrategy();

    Graphics2D bfg = (Graphics2D) bf.getDrawGraphics();

    mLevel.draw(bfg, this);

    for (GameEntity entity : mGameEntities) {
        entity.draw(bfg, this);
    }

    bfg.scale(2.0, 2.0);

    bf.show();

}

The draw calls basically just end up calling g.drawImage(..). Everything else is drawn correctly, so I do not understand why it isn't scaling everything up by a factor of 2.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
dave
  • 1,607
  • 3
  • 16
  • 20

1 Answers1

0

@MadProgrammer was correct - one must scale the Graphics2D instance before making any draw calls.

@Override
public void paint(Graphics g) {

    BufferStrategy bf = this.getBufferStrategy();

    Graphics2D bfg = (Graphics2D) bf.getDrawGraphics();

    bfg.scale(2.0, 2.0);

    mLevel.draw(bfg, this);

    for (GameEntity entity : mGameEntities) {
        entity.step();
        entity.draw(bfg, this);
    }



    bf.show();

}
dave
  • 1,607
  • 3
  • 16
  • 20