Resize without flickering?


#21

no one have an idea???


(Martí Angelats i Ribera) #22

Try this:

//When called _bitmap[0] and _bitmap[1] MUST exist
public function customResize():void
{
    var buffer0:Bitmap = _bitmap[0];
    var buffer1:Bitmap = _bitmap[1];

    _bitmap[0] = new Bitmap(new BitmapData(FP.width, FP.height, false, _color), PixelSnapping.NEVER);
    _bitmap[1] = new Bitmap(new BitmapData(FP.width, FP.height, false, _color), PixelSnapping.NEVER);

    _bitmap[0].bitmapData.copyPixels(buffer0.bitmapData, buffer0.bitmapData.rect, FP.zero);
    _bitmap[0].visible = buffer0.visible;

    _bitmap[1].bitmapData.copyPixels(buffer1.bitmapData, buffer1.bitmapData.rect, FP.zero);
    _bitmap[1].visible = buffer1.visible;

    _sprite.addChild(_bitmap[0]);
    _sprite.remoceChild(buffer0);

    _sprite.addChild(_bitmap[1]);
    _sprite.removeChild(buffer1);

    buffer0.bitmapData.dispose();
    buffer1.bitmapData.dispose();
}

Right now i’m making FP2 and i’ll take that into acount you can wait until it comes out but i’ll need a few months to relase the first unstable version.

PD: For some wierd reason the tabulation is not working properly.


#23

now i must work… but if i have time i will try it out and reporting here…

FP2: i will wait for it and write then the next game with it… :slight_smile: im very excited… :slight_smile:


#24

but… btw: are you open for suggestions for FP2???

i have many things in thought, where simply lack


#25

oh no… your suggestion for resize ends in the same flickering…


#26

okay… i have done now a simple script & project with the problem…

you can start the script with http://dkzl.de/flashpunk/flickertest/

and heres the project itself… New Project.zip (169.3 KB)


(azrafe7) #27

Try this:

  • comment out the call to FP.screen.resize() in FP.resize function (as I said in my previous post)
  • comment out wmode: "direct" in index.html

#28

i did it, but there are no changes visible :frowning:


(Martí Angelats i Ribera) #29

For any suggestions for FlashPunk 2 just write them down to the thread about it.


(Martí Angelats i Ribera) #30

Well if you really need it to be resizable, make the FP have a buffer as big as the entire window (use stage.fullScreenWidth and stage.fullScreenHeight to get the values).

Then use the camera values to center the camera (if needed).


#31

which should therefore glad that flash punk has no possibility of avoiding this trouble. i have already a camera-movement in the game… independend of the screen-resize-problem, so i cannot (and would not) use it to avoid it…


(Martí Angelats i Ribera) #32

What do you mean?

What i want to say is that you simply have two static values that represents the current width and heigh. You make an offset depending of this value. Not too hard and it will work.


#33

but the program does not, what it have to do… is this irrelevant for you??? other frameworks have no problems with it… why flashpunk?


(Martí Angelats i Ribera) #34

The main problem here is the way FlashPunk renders the world. It works using two buffers wich are rapidly changed. When you resize, you make a brand new pair of bitmapdatas wich are black. This is what you see. It’s only a frame or even less but it makes this flirck.

I’ll have a deaper look if i have time. You probably will have to wait a few days, though.

PD: The problem should be solved if using stage3D. FP2 FTW.


(azrafe7) #35

Ohh… Thought this should be smooth/flicker-free enough!? (video | swf)


#36

hmm… i see in the video no flicker… thats the target! but the swf is no different to my program… it flickers…

perhaps my computer make the different???

8core am3+ @ 3.1 GHz 16 GB ram NVidia GeForce GTX 650, 4GB