Last active
December 17, 2015 21:29
-
-
Save ispern/5675447 to your computer and use it in GitHub Desktop.
show FPS - Sencha Touch 2.2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ext.Viewport.add([ | |
{ | |
id : 'currentFPS', | |
xtype : 'component', | |
bottom: 0, | |
right : 0, | |
width : 50, | |
height: 50, | |
style : 'background-color: red; color: white;' | |
}, | |
{ | |
id : 'averageFPS', | |
xtype : 'component', | |
bottom: 0, | |
left : 0, | |
width : 50, | |
height: 50, | |
style : 'background-color: green; color: white;' | |
} | |
]); | |
var fpsIndicator = Ext.getCmp('currentFPS'), | |
fpsAverage = Ext.getCmp('averageFPS'), | |
fpsCount = 0, | |
fpsSum = 0; | |
Ext.AnimationQueue.onFpsChanged = function(fps) { | |
fpsCount++; | |
fpsSum += fps; | |
fpsIndicator.setHtml(Math.round(fps)); | |
fpsAverage.setHtml(Math.round(fpsSum / fpsCount)); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment