mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
match drawn fps to tick rate always, except for when vsync
This commit is contained in:
parent
e7cac9cd0c
commit
6044889270
1 changed files with 16 additions and 0 deletions
16
src/Main.hx
16
src/Main.hx
|
|
@ -137,7 +137,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();
|
||||||
|
|
@ -168,6 +171,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