Проектная работа - WIP
This commit is contained in:
@@ -1,23 +1,13 @@
|
||||
use bevy::{prelude::*, winit::WinitSettings};
|
||||
use std::time::Duration;
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::{
|
||||
domain::{End, SnakePath, Tail},
|
||||
observers::{cleanup_snake_path, schedule_set_velocity, tail_observer},
|
||||
};
|
||||
|
||||
/// Настройка частоты кадров
|
||||
pub fn setup_frame_rate(mut winit: ResMut<WinitSettings>) {
|
||||
use crate::domain::FRAMES_PER_SECOND;
|
||||
|
||||
winit.focused_mode =
|
||||
bevy::winit::UpdateMode::reactive(Duration::from_secs_f32(1. / FRAMES_PER_SECOND as f32));
|
||||
winit.unfocused_mode =
|
||||
bevy::winit::UpdateMode::reactive(Duration::from_secs_f32(1. / FRAMES_PER_SECOND as f32));
|
||||
}
|
||||
|
||||
/// Инициализация игрового мира
|
||||
pub fn startup(mut commands: Commands) {
|
||||
pub fn startup(mut commands: Commands, mut timer: ResMut<Time<Fixed>>) {
|
||||
timer.set_timestep_hz(32.0);
|
||||
spawn_snake(&mut commands);
|
||||
crate::debug::spawn_grid(&mut commands);
|
||||
commands.spawn(Camera2d);
|
||||
|
||||
Reference in New Issue
Block a user