Game Development Reference
In-Depth Information
profilerCanvas.unlock();
}
public function dispose():void {
removeEventListener(Event.ENTER_FRAME, runProfile);
for (var ctr:int = 0; ctr < profilerObjectArray.length; ctr++) {
profilerObjectArray[ctr] = null;
profilerObjectArray.splice(1, 0);
}
removeChild(profilerBitmap);
removeChild(messageTextField);
profilerObjectArray = null;
profilerBackground.dispose();
profilerBackground = null;
profilerCanvas.dispose();
profilerBitmap = null;
profileTimer = null;
format = null;
messageTextField = null;
frameCounter = null;
}
}
}
Designing the FrameRateProfiler technical design
Let's first take a look at the variables and functions we need to define for our profiler.
These are the public variables:
public var profilerRenderObjects:int = 500; : The number of objects to use in the
profile
public var profilerRenderLoops:int = 10; : The number of iterations to run the profile
public var profilerDisplayOnScreen:Boolean = false; : Toggles the display of the
render profiling on the screen
public var profilerXLocation:int = 0; : Sets the upper left-hand corner x position for
the profiler
public var profilerYLocation:int = 0; : Sets the upper left-hand corner y position for
the profiler
This and the four previous variables can be set to custom values in the Main.as of
the game before the profile is started. These values will be custom for each game
you create.
public var profilerFrameRateAverage:int = 0; : Holds the result of the profile when it
is complete, that is, the average frame rate of the user's machine over the duration of
the profile
Search WWH ::




Custom Search