[Papervision3D] small amend to average stats fps
ossia
info at ossiacreative.co.uk
Thu Dec 4 09:45:57 PST 2008
Hey,
I made a small amendment to the stats view to average out the fps readout.
Not rocket science but might save you 5 minutes if you need it. I found it
too flickery to be readable.
in StatsView.as change to:
override public function set fps(fps:int):void
{
fpsStore = fps;
fpsInfoTextField.text = "FPS : "+fpsStore;
fpsInfoTextField.setTextFormat(statsFormat);
}
in AbstractStatsView.as add:
public function set fpsStore(fpsStore:int):void
{
_fpsStore.push(fpsStore);
}
public function get fpsStore():int
{
var average:Number = 0;
var averageOver:uint = 10;
for (var i:Number = 0;i<_fpsStore.length;i++)
{
average += _fpsStore[i];
}
average = average/_fpsStore.length;
if (_fpsStore.length>averageOver)
{
_fpsStore.splice(0,1);
}
return average;
}
Change averageOver as required.
Regards,
Ossia
--
View this message in context: http://www.nabble.com/small-amend-to-average-stats-fps-tp20838607p20838607.html
Sent from the Papervision3D mailing list archive at Nabble.com.
More information about the Papervision3D
mailing list