Skip to content

Commit

Permalink
Add draw_fps function
Browse files Browse the repository at this point in the history
  • Loading branch information
juliohq authored and not-fl3 committed Nov 16, 2024
1 parent 1eeadbb commit 5c4132b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/rustaceanmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async fn main() {
);
}

draw_text(format!("FPS: {}", get_fps()).as_str(), 0., 16., 32., WHITE);
draw_fps();
draw_text(
format!("Rustaceanes: {}", rustaceanes.len()).as_str(),
0.,
Expand Down
7 changes: 6 additions & 1 deletion src/time.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
//! Cross platform system time access and FPS counters.
use crate::get_context;
use crate::{get_context, text::draw_text};

/// Draws the current FPS on the screen. For extra customization, please use `draw_text` instead.
pub fn draw_fps() {
draw_text(&format!("FPS: {}", get_fps()), 0., 16., 32., crate::WHITE);
}

/// Returns current FPS
pub fn get_fps() -> i32 {
Expand Down

0 comments on commit 5c4132b

Please sign in to comment.