View Single Post
  #1  
Old 01-04-2010, 03:03 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Frames-Per-Second

A small script I wrote up yesterday after the idea was sparked by Downsider.
Alt+f toggles it on and off:
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.updatespeed = .5;  // SPEED THAT THE FRAMERATE IS CHECKED, > 0.05
  
setTimer(0.05);
}

function 
onKeyPressed(keycode) {
  if (
keycode == 1094) {                // OPENS WITH ALT+F
    
player.showfps = !player.showfps;
    
this.oldtimevar2 = timevar2 - 0.05; // START CHECK A FRAME BEHIND
    
setTimer(0.05);
  }
}

function 
onTimeout() {
  if (!
player.showfps) {
    
hideimg(200);
    return;
  } 
  
temp.framediff = (@timevar2-this.oldtimevar2).substring(0,5)/this.updatespeed;
  
temp.framerate = int((1/framediff)*20+.5);
  
// FRAME RATE CAN NOT EXCEED 20 OR HIT 0
  
if (framerate > 20 || framerate == 0) framerate = 20;
  
with (findimg(200)) {
    
x = GUIContainer.width-150;
    
y = GUIContainer.height-75;
    
font = $pref::graal::defaultfontname;
    
zoom = $pref::graal::defaultfontsize/24;
    
layer = 4;
    
textshadow = true;
    
text = "f: " @ framerate;
  }
  
this.oldtimevar2 = timevar2;
  
setTimer(this.updatespeed);
} 

And in a level with 1024 images being displayed, running at a low fps:
Reply With Quote