Closed gwennguihal closed 12 years ago
Do you mean it changes to 30fps permanently, or just during the transition?
If it's just during the transition, then I think it's due to calling Math.pow every tick in the easing functions used during the transition.
Math.pow can take a lot of resources because of the accuracy required by java's StrictMath. You might try changing to a function that just approximates pow
What I did was replace the call to Math.pow with this:
/** double style approximation of pow
* using IEEE Double exploitation
*/
final int x = (int) (Double.doubleToLongBits((double)t) >> 32);
final int y = (int) (((double) 1/rate) * (x - 1072632447) + 1072632447);
float result = (float) Double.longBitsToDouble(((long) y) << 32);
Hello,
No, it's not just during transition but after. But I mean it's because my texture which is big (800x480) : I did some tests and the framerate dont' decrease, it stays at 43fps all the time. Thanks for the Math.pow tricks :)
I notice a problem :
When I start just one CCScene, framerate is 60fps, but if I change of scene (2 or more times) with transition, framerate decreases at 30fps. My scenes are very simple :
SplashScreenLayer Scene and Home Scene (the sames for test) :
public static CCScene scene() { CCScene s = CCScene.node(); SplashScreenLayer layer = new SplashScreenLayer(); s.addChild(layer); return s; }
GameManager.sharedGameManager().changeScene :
public void changeScene(int sceneID) { CCScene newScene; CCScene oldScene;
myrddin (sorry for my english)