Screen Scale and Stage


(Oli) #1

does anyone know how to change the screen stage while keeping the same stage dimension

This is in my main initially super(500, 480, 60, false);

as I increased the scale the stage gets bigger

thx


(Zachary Lewis) #2

The size you declare in your constructor is the size of the buffer FlashPunk renders to. The size of the stage is the size of the container of your buffer.

If you want to draw on a buffer size 320x240 that is scaled double, your stage should be set to 640x480.

[SWF(width=640, height=480)]

public class Main extends Engine {

  function Main()  {
    super(320, 240, 60, false);
    FP.screen.scale = 2;
  }
}

(Oli) #3

can you change that buffer size tough in another class than the main


(Martí Angelats i Ribera) #4

Yes you can.

FP.resize(newWidth, newHeight);

By the way, it’s not recomended to abuse this method (something like calling it every frame) becouse it could generate a firking effect (actually some people had this problem).

PS: The size of this method is before applying the scale.