56 lines
1.4 KiB
Rust
56 lines
1.4 KiB
Rust
use crate::common::messages::ExitRequestMessage;
|
|
use crate::common::plugin::CommonUiPlugin;
|
|
use crate::common::systems::exit_system;
|
|
use bevy::camera::ScalingMode;
|
|
use bevy::prelude::*;
|
|
|
|
|
|
mod common;
|
|
mod gameplay;
|
|
mod states;
|
|
mod ui;
|
|
|
|
use crate::states::game::state::MainGameState;
|
|
use crate::states::main_menu::state::MainMenuState;
|
|
use crate::states::settings_menu::state::SettingsMenuState;
|
|
|
|
const FACTOR: u32 = 80;
|
|
const WIDTH: u32 = 16;
|
|
const HEIGHT: u32 = 9;
|
|
|
|
|
|
fn main() {
|
|
App::new()
|
|
.add_message::<ExitRequestMessage>()
|
|
.add_plugins(DefaultPlugins.set(WindowPlugin {
|
|
primary_window: Some(Window {
|
|
title: "alpha".into(),
|
|
resolution: (WIDTH * FACTOR, HEIGHT * FACTOR).into(),
|
|
resizable: true,
|
|
..default()
|
|
}),
|
|
..default()
|
|
}))
|
|
.add_plugins((
|
|
CommonUiPlugin,
|
|
MainMenuState,
|
|
SettingsMenuState,
|
|
MainGameState,
|
|
))
|
|
.add_systems(Startup, setup)
|
|
.add_systems(Update, exit_system)
|
|
.run();
|
|
}
|
|
|
|
fn setup(mut commands: Commands) {
|
|
let projection = Projection::Orthographic(OrthographicProjection {
|
|
scaling_mode: ScalingMode::Fixed {
|
|
width: (WIDTH * FACTOR) as f32,
|
|
height: (HEIGHT * FACTOR) as f32,
|
|
},
|
|
scale: 1.00,
|
|
..OrthographicProjection::default_2d()
|
|
});
|
|
|
|
commands.spawn((Camera2d, projection));
|
|
}
|