double Emu::Step() { //const double dt = 1000.0 / base_freq_hz_;//options.cpu_freq(); 0.00058f;//16.667f; timing.current_cycles = utimer.GetCurrentCycles(); timing.time_span = (timing.current_cycles - timing.prev_cycles) * utimer.resolution(); if (timing.time_span > 500.0) //clamping time timing.time_span = 500.0; timing.span_accumulator += timing.time_span; cartridge()->MBCStep(timing.time_span); while (timing.span_accumulator >= timing.step_dt) { cpu_cycles_per_step_ = 0; cpu_->Step(); timing.span_accumulator -= timing.step_dt*cpu_cycles_per_step_; cpu_cycles_ += cpu_cycles_per_step_; } timing.misc_time_span += timing.time_span; if (timing.misc_time_span >= 1000.0) { cycles_per_second_ = uint64_t((cpu_cycles_ - last_cpu_cycles_)*(timing.misc_time_span/1000.0)); frequency_mhz_ = double( cycles_per_second_ ) * 0.000001f; last_cpu_cycles_ = cpu_cycles_; timing.misc_time_span -= 1000.0; } timing.total_cycles += timing.current_cycles-timing.prev_cycles; timing.prev_cycles = timing.current_cycles; timing.fps_time_span += timing.time_span; return timing.span_accumulator; }
int expose_hook(t_all *all) { mlx_put_image_to_window(all->env.mlx, all->env.win,\ all->img.img, 0, 0); cartridge(all); return (0); }
ammo_factory::ammo_factory() : NineMil(9.0f), Bullet(NineMil, 7.45f / 1000, "9mm FMJ"), Case(NineMil, 5.0f, 0.862f, "9x19mm Case"), Prop(3000.0f, "Gunpowder"), Primer(5.0f, 1.0f, "Cap"), Ammo(cartridge(Case, &primer(Primer), &Prop, &Bullet, "9x19mm Parabellum"), 5) { }
int loop_hook(t_all *all) { if (all->re) { if (all->re == -1) ft_free_all(all); ft_bzero(all->img.data, WIN_SZ_X * WIN_SZ_Y * 4); ft_put_3d_map(all); mlx_put_image_to_window(all->env.mlx, all->env.win,\ all->img.img, 0, 0); cartridge(all); all->re = 0; } return (0); }