mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-12 14:12:20 -06:00
refactor: huge refactor into atlas-based resources
This commit is contained in:
@@ -1,23 +1,19 @@
|
||||
//! This module contains all the constants used in the game.
|
||||
|
||||
/// The width of the game board, in cells.
|
||||
pub const BOARD_WIDTH: u32 = 28;
|
||||
/// The height of the game board, in cells.
|
||||
pub const BOARD_HEIGHT: u32 = 31;
|
||||
use glam::UVec2;
|
||||
|
||||
/// The size of each cell, in pixels.
|
||||
pub const CELL_SIZE: u32 = 24;
|
||||
pub const CELL_SIZE: u32 = 8;
|
||||
/// The size of the game board, in cells.
|
||||
pub const BOARD_CELL_SIZE: UVec2 = UVec2::new(28, 31);
|
||||
|
||||
/// The offset of the game board from the top-left corner of the window, in
|
||||
/// cells.
|
||||
pub const BOARD_OFFSET: (u32, u32) = (0, 3);
|
||||
/// The scale factor for the window (integer zoom)
|
||||
pub const SCALE: f32 = 2.6;
|
||||
|
||||
/// The width of the window, in pixels.
|
||||
pub const WINDOW_WIDTH: u32 = CELL_SIZE * BOARD_WIDTH;
|
||||
/// The height of the window, in pixels.
|
||||
///
|
||||
/// The map texture is 6 cells taller than the grid (3 above, 3 below), so we
|
||||
/// add 6 to the board height to get the window height.
|
||||
pub const WINDOW_HEIGHT: u32 = CELL_SIZE * (BOARD_HEIGHT + 6);
|
||||
/// The offset of the game board from the top-left corner of the window, in cells.
|
||||
pub const BOARD_OFFSET: UVec2 = UVec2::new(0, 0);
|
||||
/// The size of the game board, in pixels.
|
||||
pub const BOARD_PIXEL_SIZE: UVec2 = UVec2::new(BOARD_CELL_SIZE.x * CELL_SIZE, BOARD_CELL_SIZE.y * CELL_SIZE);
|
||||
|
||||
/// An enum representing the different types of tiles on the map.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
@@ -89,7 +85,7 @@ impl FruitType {
|
||||
}
|
||||
|
||||
/// The raw layout of the game board, as a 2D array of characters.
|
||||
pub const RAW_BOARD: [&str; BOARD_HEIGHT as usize] = [
|
||||
pub const RAW_BOARD: [&str; BOARD_CELL_SIZE.y as usize] = [
|
||||
"############################",
|
||||
"#............##............#",
|
||||
"#.####.#####.##.#####.####.#",
|
||||
|
||||
Reference in New Issue
Block a user