mirror of
https://github.com/kirjavascript/trueLMAO.git
synced 2024-06-02 11:37:28 -04:00
framecounter improvement
This commit is contained in:
parent
6f7f18e049
commit
965bdcf73c
|
@ -12,6 +12,13 @@ use gfx::Gfx;
|
|||
|
||||
// TODO: composit layers in gfx istead of multiple buffers
|
||||
// just draw directly to layers
|
||||
// just have two layers
|
||||
|
||||
|
||||
// set version?? store in core
|
||||
// or just have a parser to get the version
|
||||
|
||||
//
|
||||
|
||||
pub struct Megadrive {
|
||||
pub core: ConfiguredCore<AutoInterruptController, mem::Mem>,
|
||||
|
|
|
@ -46,6 +46,7 @@ impl Default for FrameCounter {
|
|||
}
|
||||
|
||||
impl FrameCounter {
|
||||
/// returns frames to render
|
||||
pub fn tick(&mut self) -> u64 {
|
||||
let diff = Instant::now().duration_since(self.epoch);
|
||||
let frames = (diff.as_millis() as f64 * 0.05992274) as u64; // TODO: PAL
|
||||
|
@ -54,8 +55,9 @@ impl FrameCounter {
|
|||
self.frames = frames;
|
||||
self.frames_to_render
|
||||
}
|
||||
pub fn frames_to_render(&self) -> u64 {
|
||||
self.frames_to_render
|
||||
/// for unpausing
|
||||
pub fn reset_epoch(&mut self) {
|
||||
self.epoch = Instant::now();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue