Skip to content

Commit

Permalink
dealing with issue #56
Browse files Browse the repository at this point in the history
  • Loading branch information
saharan committed May 16, 2024
1 parent 6728abb commit c0c828a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
5 changes: 5 additions & 0 deletions bin/js_modules/OimoPhysics.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
class HxOverrides {
static now() {
return Date.now();
}
}
var oimo = oimo || {};
if(!oimo.collision) oimo.collision = {};
if(!oimo.collision.broadphase) oimo.collision.broadphase = {};
Expand Down
1 change: 1 addition & 0 deletions build-js-ts.hxml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#
# After build you will need to edit generated JS file:
# Remove all lines before `var oimo = oimo || {};`
# - But just keep `HxOverrides` class!
# Replace last two lines `export.ts.Export.main();
# var Export = $hx_exports["Export"];`
# with next: `export {oimo};`
Expand Down
12 changes: 2 additions & 10 deletions src/oimo/m/M.hx
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,9 @@ class M {

public static macro function profile(main:Expr) {
return macro {
#if js
var st:Float = js.Browser.window.performance.now() / 1000;
#else
var st:Float = haxe.Timer.stamp();
#end
var st:Float = haxe.Timer.stamp();
$main;
#if js
var en:Float = js.Browser.window.performance.now() / 1000;
#else
var en:Float = haxe.Timer.stamp();
#end
var en:Float = haxe.Timer.stamp();
(en - st) * 1000; // in ms
};
}
Expand Down

0 comments on commit c0c828a

Please sign in to comment.