bfops / playform

Voxel sandbox project in Rust
http://playformdev.blogspot.ca/
MIT License
212 stars 24 forks source link

Add piston's fps_counter #176

Open acerix opened 8 years ago

acerix commented 8 years ago

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.

bfops commented 8 years ago

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

acerix commented 8 years ago

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?

bfops commented 8 years ago

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.

acerix commented 8 years ago

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

acerix commented 8 years ago

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...

cooperra commented 8 years ago

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

bfops commented 8 years ago

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.