Comments (4)
How about Gdx.graphics.setForegroundFPS(int)
?
from libgdx.
I think this is so simple to implement by ourself the consumer coders that consume this libgdx library.
First, you declare a function that takes in the elapsed time between the two frames. So that, later you can pass delta time to the function.
in the render() method of Game class or Screen class.
Let's take one example if you want to limit it to 60FPS, then each elapsed time in between two frames should be 1/60 second or 0.01667. Then, you check if the elapsed time is less than that, you need to add that up so it becomes 0.01667. To get how much you need to add is 0.01667 - elapsedTime, and store it as temporary variable. Meaning, you add the elapsedTime with this temporary variable so it becomes 0.01667 second every frame.
If it is higher you substract by that amount.
I.e elapsedTime-= (elapsedTime-0.01667).
Hopefully, you get the idea.
Then, you just return that number.
Then, you can use that return value in the render() method.
from libgdx.
AnotherCoder1
I tried everything but only Thread.sleep works, It would be better to have a built-in method like
"Gdx.graphics.setFrameRateLimit(targetFPS);" for straightforward frame rate control. Thanks for your suggestions!
from libgdx.
How about
Gdx.graphics.setForegroundFPS(int)
?
Oh wow... for some reason I didn't see it, THANK YOU!
from libgdx.
Related Issues (20)
- AndroidFragmentApplication dies onPause HOT 1
- Performance issues on Android when enabling config.useGL30 HOT 7
- GWT requests unnecessary microphone permission HOT 5
- Stage.drawDebug does not work in combination with GL3 due to ShapeRenderer shader not being compliant HOT 2
- AndroidPreferences.flush() has no way to enforce synchronous saving HOT 2
- If an animation starts on frame 1 or more, rather than frame 0, AnimationController doesn't animate it properly
- glReadPixels does not support offset parameter crucial to read pixels asynchronously HOT 2
- gdx and gdx.jnigen.loader causes split module issue over package com.badlogic.gdx.utils HOT 6
- GWT preloader doesn't use percent-encoding HOT 2
- performance: unnecessary window.makeCurrent() in LWJGL3 backend HOT 4
- Add arm64 capabilities to Info.plist.xml HOT 1
- Suggestion to modify code in Sprite.rotate() method in com.badlogic.gdx.graphics.g2d.Sprite package HOT 4
- None of the 3D test apps in ..\tests\gdx-tests\src\com\badlogic\gdx\tests\g3d are build or runnable
- GestureDetector / ActorGestureListener depend on absolute amount of touch points HOT 1
- LibGDX + KMP (Kotlin Multiplatform) HOT 1
- mistake
- Using multiple textures in a single shader
- Allocating more than 64 Mesh objects leads to double free / corruption and core dump HOT 2
- Cannot pass an inputstream to Libgdx classes without touching the hard disk. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libgdx.