Skip to content

Instantly share code, notes, and snippets.

@ruby0x1
Forked from AndreiRudenko/Fps.hx
Last active July 12, 2017 11:47
Show Gist options
  • Save ruby0x1/effb9014eb0de75b64c5 to your computer and use it in GitHub Desktop.
Save ruby0x1/effb9014eb0de75b64c5 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