53 lines
1.3 KiB
Rust
53 lines
1.3 KiB
Rust
use std::sync::Arc;
|
|
|
|
use anyhow::Result;
|
|
use engine::prelude::*;
|
|
|
|
use crate::board::Board;
|
|
|
|
pub struct MillGame {
|
|
board: Arc<Board>,
|
|
scene: SceneHandle,
|
|
}
|
|
|
|
impl MillGame {
|
|
pub fn new(engine: Arc<Engine>) -> Result<Arc<Self>> {
|
|
let mut scene = SceneHandle::new(&engine)?;
|
|
|
|
scene.activate()?;
|
|
|
|
Ok(Arc::new(Self {
|
|
board: Board::new(engine, &mut scene)?,
|
|
scene,
|
|
}))
|
|
}
|
|
}
|
|
|
|
impl EngineObject for MillGame {
|
|
fn name(&self) -> &str {
|
|
"MillGame"
|
|
}
|
|
|
|
fn update(&self) -> Result<()> {
|
|
Ok(())
|
|
}
|
|
|
|
fn event(&self, event: EngineEvent) -> Result<()> {
|
|
match event {
|
|
EngineEvent::MouseMotion(_, _) => todo!(),
|
|
EngineEvent::MouseButtonDown(_) => todo!(),
|
|
EngineEvent::MouseButtonUp(_) => todo!(),
|
|
EngineEvent::MouseWheel(_, _, _) => todo!(),
|
|
EngineEvent::KeyDown(_) => todo!(),
|
|
EngineEvent::KeyUp(_) => todo!(),
|
|
EngineEvent::ButtonDown(_) => todo!(),
|
|
EngineEvent::ButtonUp(_) => todo!(),
|
|
EngineEvent::ControllerAxis(_) => todo!(),
|
|
EngineEvent::ControllerAdded(_) => todo!(),
|
|
EngineEvent::ControllerRemoved(_) => todo!(),
|
|
EngineEvent::FileDrop(_) => todo!(),
|
|
}
|
|
|
|
Ok(())
|
|
}
|
|
}
|