Files
war-in-tunnels/src/app/states/skirmish.rs
T
GarandPLG c4e28255b6 Move skirmish Offset and FocusedCell to own module
Extract Offset and FocusedCell structs from skirmish.rs into a new
skirmish_states module. Re-export the structs from the top-level states
module and adjust imports in skirmish.rs.
2026-04-01 22:10:25 +02:00

46 lines
1011 B
Rust

use crate::app::{
states::{FocusedCell, Offset},
widgets::CellWidget,
};
use clap::ValueEnum;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SkirmishState {
pub id: usize,
pub name: &'static str,
pub map_width: usize,
pub map_height: usize,
pub vertical_offset: Offset,
pub horizontal_offset: Offset,
pub board_cells: Vec<CellWidget>,
pub zoom_level: ZoomLevel,
pub focused_cell: FocusedCell,
}
impl SkirmishState {
pub fn init_board(&mut self) {
if !self.board_cells.is_empty() {
return;
}
for row in 0..self.map_height {
for col in 0..self.map_width {
self.board_cells.push(CellWidget::new(row, col, false));
}
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, ValueEnum)]
pub enum GameMode {
LastManStanding,
FrontLines,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, ValueEnum)]
pub enum ZoomLevel {
ZoomedIn,
Default,
ZoomedOut,
}