Skip to content

Commit dea95ec

Browse files
committed
Better default value for suggestedFps
In any game that handles fps issues as seen in http://phaser.io/examples/v2/time/slow-down-time the game will hang if game.fpsProblemNotifier fires early on, before game.time.suggestedFps has any value other than null. The docs recommend waiting a few seconds before accesing suggestedFps. Since it's hard to tell exactly how long "a few seconds" is, shouldn't suggestedFps be initialized to the same value as desidedFps? I think it's better to get an inaccurate value for a few frames than an invalid value. It means users don't have to care about the specifics of how and when suggestedFps gets its value.
1 parent db641ca commit dea95ec

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/time/Time.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,13 @@ Phaser.Time = function (game) {
113113
* The suggested frame rate for your game, based on an averaged real frame rate.
114114
* This value is only populated if `Time.advancedTiming` is enabled.
115115
*
116-
* _Note:_ This is not available until after a few frames have passed; use it after a few seconds (eg. after the menus)
116+
* _Note:_ This is not available until after a few frames have passed; until then
117+
* it's set to the same value as desiredFps.
117118
*
118119
* @property {number} suggestedFps
119120
* @default
120121
*/
121-
this.suggestedFps = null;
122+
this.suggestedFps = this.desiredFps;
122123

123124
/**
124125
* Scaling factor to make the game move smoothly in slow motion

0 commit comments

Comments
 (0)