Modify FPS display in json
12 October 2016 17:43
Hi,
For my project, I use .json export format and I noticed that we want display FPS, we can use :
So : "show_fps: true".
My question is the following :
Is there a way to display fps but in a controlled manner?
I wish I could change where it appears, font color, font size…
It's possible ?
Thanks in advance.
For my project, I use .json export format and I noticed that we want display FPS, we can use :
exports.init = function () {
m_app.init({
canvas_container_id: "main_canvas_container",
callback: init_cb,
physics_enabled: true,
show_fps: true
});
}
So : "show_fps: true".
My question is the following :
Is there a way to display fps but in a controlled manner?
I wish I could change where it appears, font color, font size…
It's possible ?
Thanks in advance.
I'm not crazy ! My reality is just different than yours.
12 October 2016 17:46
Hi!
Sure, you can do this by registering an fps callback and updating the value of your custom HTML element.
Sure, you can do this by registering an fps callback and updating the value of your custom HTML element.
13 October 2016 11:13
Ok thanks, I managed to recover fps.
For interested :
Now, I noticed in the main.js some interesting things :
- get_rendered_info() –> What is exactly this infos ? How display or exploit this ?
- pause() –> This method pauses the application but what exactly ? The refresh ? The shadow calculation ? Events ? Everithing ?
pause() is interesting if it release computer capacity, so I want paused my app if the user is in a other webpage and replay if the user come back. How know if the app (or web page) is active ?
Thanks.
For interested :
function fps_cb(fps_avg, phy_fps_avg) {
console.log(fps_avg);
}
function load_cb(data_id) {
m_main.set_fps_callback(fps_cb);
...
}
Now, I noticed in the main.js some interesting things :
- get_rendered_info() –> What is exactly this infos ? How display or exploit this ?
- pause() –> This method pauses the application but what exactly ? The refresh ? The shadow calculation ? Events ? Everithing ?
pause() is interesting if it release computer capacity, so I want paused my app if the user is in a other webpage and replay if the user come back. How know if the app (or web page) is active ?
Thanks.
I'm not crazy ! My reality is just different than yours.
14 October 2016 11:03
- get_rendered_info() –> What is exactly this infos ? How display or exploit this ?You can just call this function and check the output. But not all browsers support the required extension. Chrome does support it.
- pause() –> This method pauses the application but what exactly ? The refresh ? The shadow calculation ? Events ? Everithing ?Yes. Basically it pauses everything: graphics/physics/logics. But you don't need to track if the page is active. Browsers are managing this for us. So the page doesn't make any calculations.
14 October 2016 11:29