playform icon indicating copy to clipboard operation
playform copied to clipboard

Add piston's fps_counter

Open acerix opened this issue 9 years ago • 7 comments

I'm trying to learn Rust, figured I would start with something small...

https://github.com/bfops/playform/issues/37

This PR includes the fps_counter crate (from Piston developers), and displays the FPS (commented out in view_thread.rs).

Let me know if this looks good, and I'll add something to display it in the viewport, otherwise please let me know how it could be done better.

acerix avatar Jan 21 '16 02:01 acerix

It looks fine, but there's not really any GUI right now, so I can't think of where you'd add it?

bfops avatar Jan 23 '16 16:01 bfops

For now, it just displays in the console (println), but I'm thinking something looking like this:

http://rawgit.com/mrdoob/stats.js/master/examples/theming.html

I noticed playform is moving from piston to glium, so I suppose the FPS display should be glium-compatible, maybe using glium-text?

acerix avatar Feb 02 '16 01:02 acerix

Why not just let _fps? println every frame is a lot of output.

Playform doesn't use piston; it would just be migrating to glium from straight OpenGL. I haven't looked at glium-text, or any of the 2D/GUI libraries, which might also have text support.

bfops avatar Feb 02 '16 01:02 bfops

I didn't know about silencing the warning with an underscore, thanks!

acerix avatar Feb 02 '16 01:02 acerix

I remember seeing some instructions displayed before (not sure if they were removed or no longer working) so the FPS could be displayed like that for now. If the graphics wrapper is going to be glium though, it seems like glium_text is a good option, it's by the same author.

I don't know why I thought playform was using piston...

acerix avatar Feb 02 '16 02:02 acerix

https://github.com/PistonDevelopers/piston/wiki/Games-Made-With-Piston links here.

cooperra avatar Feb 11 '16 07:02 cooperra

Oh good point, I'd entirely forgotten about that. I was using piston for a little while, but I was only using little things, so I moved away from it.

bfops avatar Feb 12 '16 03:02 bfops