use std::sync::{ atomic::{AtomicU32, Ordering::SeqCst}, Arc, Mutex, }; use anyhow::Result; use assetpath::AssetPath; use engine::prelude::{cgmath::vec3, *}; use crate::{ board::{Board, BoardSlot, BoardSlotState}, objects::Objects, simple_ai::SimpleAI, }; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] pub enum StoneState { ReadyToBePlaced, Placed, Dead, } pub struct Stone { pub stone: Entity, pub state: StoneState, } #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] pub enum GameState { Placing, Main, } #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] pub enum PlayerColor { White, Black, } impl PlayerColor { pub fn swap(&mut self) { *self = match *self { PlayerColor::White => PlayerColor::Black, PlayerColor::Black => PlayerColor::White, } } } pub struct MillGame { board: Arc>, white_stones: Mutex<[Stone; 9]>, black_stones: Mutex<[Stone; 9]>, state: Mutex, current_player: Mutex, scene: Mutex, camera_controls: Mutex, mouse_x: AtomicU32, mouse_y: AtomicU32, simple_ai: SimpleAI, white_player_label: Arc