use bevy::prelude::{ColorMaterial, Entity, Handle, SystemLabel}; pub const ARENA_WIDTH: u32 = 10; pub const ARENA_HEIGHT: u32 = 10; pub struct SnakeHead { pub direction: Direction, } pub struct Food; pub struct GrowthEvent; #[derive(Default, Copy, Clone, Eq, PartialEq, Hash)] pub struct Position { pub x: i32, pub y: i32, } pub struct GridSize { pub width: f32, pub height: f32, } impl GridSize { pub fn square(x: f32) -> GridSize { Self { width: x, height: x, } } } pub struct Materials { pub head_material: Handle, pub segment_material: Handle, pub food_material: Handle, } #[derive(PartialEq, Copy, Clone)] pub enum Direction { Left, Up, Right, Down, } impl Direction { pub fn opposite(self) -> Self { match self { Self::Left => Self::Right, Self::Right => Self::Left, Self::Up => Self::Down, Self::Down => Self::Up, } } } #[derive(SystemLabel, Debug, Hash, PartialEq, Eq, Clone)] pub enum SnakeMovement { Input, Movement, Eating, Growth, } pub struct SnakeSegment; #[derive(Default)] pub struct SnakeSegments { pub segments: Vec, }