Skip to content

Instantly share code, notes, and snippets.

@AndreiRudenko
Forked from ruby0x1/FPS.hx
Last active August 29, 2015 14:26
Show Gist options
  • Save AndreiRudenko/0bc31b83abe934229ae3 to your computer and use it in GitHub Desktop.
Save AndreiRudenko/0bc31b83abe934229ae3 to your computer and use it in GitHub Desktop.
Simple FPS Text instance, modified from @RudenkoArt as an example for http://luxeengine.com
package;
import luxe.Text;
import luxe.Color;
import luxe.Vector;
import luxe.Log.*;
import luxe.options.TextOptions;
class FPS extends Text {
public function new( ?_options:luxe.options.TextOptions ) {
def(_options, {});
def(_options.name, "fps");
def(_options.pos, new Vector(Luxe.screen.w - 5, 5));
def(_options.point_size, 14);
def(_options.align, TextAlign.right);
super(_options);
} //new
public override function update(dt:Float) {
// text = 'fps : ' + Math.round(1.0/dt);
text = 'FPS : ' + Math.round(1.0/Luxe.debug.dt_average);
} //update
} //FPS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment