show fps counter
This commit is contained in:
parent
61a88f44aa
commit
8def3c005d
1 changed files with 4 additions and 8 deletions
12
src/main.rs
12
src/main.rs
|
@ -6,13 +6,13 @@ mod constants;
|
|||
use crate::ant::Ant;
|
||||
use constants::*;
|
||||
use macroquad::color::*;
|
||||
use macroquad::input::{
|
||||
is_key_down, is_mouse_button_down, is_quit_requested, mouse_position, KeyCode, MouseButton,
|
||||
};
|
||||
use macroquad::input::{is_key_down, is_quit_requested, KeyCode};
|
||||
use macroquad::miniquad::conf::Conf;
|
||||
use macroquad::prelude::{
|
||||
clear_background, draw_texture, get_frame_time, next_frame, Image, Texture2D,
|
||||
};
|
||||
use macroquad::text::draw_text;
|
||||
use macroquad::time::get_fps;
|
||||
|
||||
fn window_conf() -> Conf {
|
||||
Conf {
|
||||
|
@ -47,16 +47,12 @@ async fn main() {
|
|||
if is_key_down(KeyCode::Escape) || is_quit_requested() {
|
||||
return;
|
||||
}
|
||||
if is_mouse_button_down(MouseButton::Left) {
|
||||
let mouse = mouse_position();
|
||||
dbg!(&mouse);
|
||||
//food.push(Food::new(Vec2::new(mouse.0, mouse.1)));
|
||||
}
|
||||
|
||||
// render
|
||||
clear_background(BLACK);
|
||||
let texture = Texture2D::from_image(&trail_map);
|
||||
draw_texture(texture, 0., 0., WHITE);
|
||||
draw_text(&get_fps().to_string(), 0., 20., 20., WHITE);
|
||||
|
||||
next_frame().await
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue