Comments (2)
Thanks for asking! You can use the setAnimationInterval
function, this function takes a frametime value, so If you want to have 120 fps then you have to pass a float fraction of 1.0 / 120.0
and that will make the game render at that framerate.
// this will render the game at 30 fps, cool for cinematic experiences
Director::getInstance()->setAnimationInterval(1.0f / 30);
For desktop computers (Windows, linux) If you don't know the refresh rate of the GPU the user is running you can get that value using glfwGetVideoMode(glfwGetPrimaryMonitor())->refreshRate
This will give you the speed at which the GPU updates the monitor NOT the monitor's hertz.
This is good for limiting the framerate but causes stuttering because a 144hz display on a 144fps can cause stuttering and horizontal lines because there is no vertical sync. To enable VSYNC you can tell glfw to do so by calling glfwSwapInterval(1);
this will enable VSYNC and the display won't have jittery lines (It would also cap the framerate to the GPU's refresh rate) and glfwSwapInterval(0);
to turn off VSYNC.
for mobile phones that support 120fps you unfortunately can't get the information about update rate, but you can run the game at 120fps in mobile devices by just setting the interval to 0.
// The phone's OS will cap the fps by the displays refresh rate so setting this value to 0
// will tell the OS to update the context as fast as the display of the phone can go.
// or what the user has set the refresh rate of the phone in the settings.
Director::getInstance()->setAnimationInterval(0);
Hope that helps <3 Feel free to ask!
from rebound.
@DelinWorks
Maybe a Q&A for axmol?
from rebound.
Related Issues (10)
- I tried it... (axmol latest) and got this errors HOT 25
- "prototype_win32_release" like "I Can Transform" HOT 1
- Works on my phone. HOT 17
- Please add a license HOT 1
- Maybe add a discussion section HOT 1
- FMOD vs AudioEngine HOT 8
- Can we get a new release for commenting/testing? HOT 1
- Questions about the "Rebound"-Editor... HOT 3
- Any new release for testing? HOT 1
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 rebound.