I have a code where I get these outputs. I use libgdx framework and it appears that resize is called twice since the application startup. Wondering why is it called twice since I haven't done anything unusual. The classes below are extended from AbstractScreen which implements Screen class. Link for Application LifeCycle: http://code.google.com/p/libgdx/wiki/ApplicationLifeCycle
The tags refer to the Functions being called:
SHOW(): devInfo.glyphWidth=18
SHOW(): devInfo.glyphHeight=27
AbstractScreen.resize: screenScaleX=0.8
AbstractScreen.resize: screenScaleY=0.8
resize(): devInfo.glyphWidth=14
resize(): devInfo.glyphHeight=21
resize(): logoSplashSprite.getWidth=204.8
resize(): logoSplashSprite.getHeight=204.8
AbstractScreen.resize: screenScaleX=0.8
AbstractScreen.resize: screenScaleY=0.8
resize(): devInfo.glyphWidth=11
resize(): devInfo.glyphHeight=16
resize(): logoSplashSprite.getWidth=204.8
resize(): logoSplashSprite.getHeight=204.8
fps 0
fps 65
.
.
.
Thanks Souvik
It would be better if you could post some example code from you 'AbstractScreen' class and your 'Game' class. I assume you have the following setup:
public class MySuperGame extends Game {
@Override
public void create() {
setScreen(new MyScreen(this));
}
@Override
public void resize(int width, int height) {
super.resize(width,height);
}
}
According to the application life cycle you posted up there, when a 'Game' class is initiated the following methods of the 'Game' class get called:
The problem right there is that when you make a call to 'setScreen()' within your 'create()' method, your 'Game' class sets the screen and makes a call to the 'resize()' method of the newly set screen.
Then, the 'resize()' method of your 'Game' class gets called. And again, the 'Game' class makes a call to the 'resize()' method of you screen.
To summarize, the 'resize()' method of your screen gets called twice. Once when the screen is set and another time when the game is resized.
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With