mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-27 05:01:38 +00:00
match drawn fps to tick rate always, except for when vsync
This commit is contained in:
parent
0edf005ea1
commit
3900bdcf0f
1 changed files with 16 additions and 0 deletions
16
src/Main.hx
16
src/Main.hx
|
|
@ -145,7 +145,10 @@ class Main extends hxd.App {
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static var updateDT:Float;
|
||||||
|
|
||||||
override function update(dt:Float) {
|
override function update(dt:Float) {
|
||||||
|
updateDT = dt;
|
||||||
super.update(dt);
|
super.update(dt);
|
||||||
if (loaded) {
|
if (loaded) {
|
||||||
ProfilerUI.begin();
|
ProfilerUI.begin();
|
||||||
|
|
@ -177,6 +180,19 @@ class Main extends hxd.App {
|
||||||
ProfilerUI.end();
|
ProfilerUI.end();
|
||||||
}
|
}
|
||||||
super.render(e);
|
super.render(e);
|
||||||
|
|
||||||
|
#if hl
|
||||||
|
static var dtAccumulator;
|
||||||
|
dtAccumulator += updateDT;
|
||||||
|
if (Settings.optionsSettings.fpsLimit <= 0) {
|
||||||
|
e.driver.present();
|
||||||
|
} else {
|
||||||
|
if (dtAccumulator >= 1.0 / Settings.optionsSettings.fpsLimit) {
|
||||||
|
e.driver.present();
|
||||||
|
dtAccumulator = 0.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
static function main() {
|
static function main() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue