#游戏引擎 #时钟 #游戏 #时间

game_clock

提供简单易用且高效的时钟,适用于游戏(引擎)

3个稳定版本

1.1.1 2021年4月11日
1.1.0 2020年11月17日
1.0.0 2020年11月17日

#910游戏开发

Download history · Rust 包仓库 18/week @ 2024-03-11 · Rust 包仓库 16/week @ 2024-03-18 · Rust 包仓库 15/week @ 2024-03-25 · Rust 包仓库 82/week @ 2024-04-01 · Rust 包仓库 8/week @ 2024-04-08 · Rust 包仓库 15/week @ 2024-04-15 · Rust 包仓库 14/week @ 2024-04-22 · Rust 包仓库 7/week @ 2024-04-29 · Rust 包仓库 12/week @ 2024-05-06 · Rust 包仓库 9/week @ 2024-05-13 · Rust 包仓库 16/week @ 2024-05-20 · Rust 包仓库 13/week @ 2024-05-27 · Rust 包仓库 14/week @ 2024-06-03 · Rust 包仓库 14/week @ 2024-06-10 · Rust 包仓库 9/week @ 2024-06-17 · Rust 包仓库 15/week @ 2024-06-24 · Rust 包仓库

每月54次下载
用于 game_engine_core

Apache-2.0

10KB
137

Game Clock

游戏时钟

支持开源开发者!♥️
Become a patron

阅读文档

功能

  • 为游戏和游戏引擎添加简单的时钟。

使用方法

将以下内容添加到您的Cargo.toml文件中

game_clock = "*"

使用时钟的示例

use game_clock::Time;
use std::time::Duration;
fn main() {
    let mut time = Time::default();
    time.set_fixed_time(Duration::from_secs_f64(1.0 / 20.0));

    let step = 1.0 / 60.0;
    for _ in 0..60 {
        time.advance_frame(Duration::from_secs_f64(step));
        { } // ...Run game logic, rendering, etc...
        while time.step_fixed_update() { // runs 20 times in a frame.
            { } // Run fixed frame logic (ie. physics)
        }
    }
}

维护者信息

  • 维护者:Jojolepro
  • 联系方式:jojolepro [at] jojolepro [dot] com
  • 网站: jojolepro.com
  • Patreon: patreon

无运行时依赖