generated from tipragot/rust
Change oraganization of ui's programs #94
|
@ -6,11 +6,10 @@ use networking::PlayerRank;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
pub mod camera;
|
pub mod camera;
|
||||||
pub mod hover;
|
|
||||||
pub mod map;
|
pub mod map;
|
||||||
pub mod networking;
|
pub mod networking;
|
||||||
pub mod responsive_scale;
|
|
||||||
pub mod scenes;
|
pub mod scenes;
|
||||||
|
pub mod ui;
|
||||||
|
|
||||||
/// The current scene of the game.
|
/// The current scene of the game.
|
||||||
#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)]
|
#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)]
|
||||||
|
|
|
@ -7,6 +7,7 @@ use border_wars::map::renderer::RendererPlugin;
|
||||||
use border_wars::map::selected_tile::SelectTilePlugin;
|
use border_wars::map::selected_tile::SelectTilePlugin;
|
||||||
use border_wars::networking::NetworkingPlugin;
|
use border_wars::networking::NetworkingPlugin;
|
||||||
use border_wars::scenes::ScenesPlugin;
|
use border_wars::scenes::ScenesPlugin;
|
||||||
|
use border_wars::ui::UiPlugin;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::new()
|
App::new()
|
||||||
|
@ -17,5 +18,6 @@ fn main() {
|
||||||
.add_plugins(SelectTilePlugin)
|
.add_plugins(SelectTilePlugin)
|
||||||
.add_plugins(NetworkingPlugin)
|
.add_plugins(NetworkingPlugin)
|
||||||
.add_plugins(MapGenerationPlugin)
|
.add_plugins(MapGenerationPlugin)
|
||||||
|
.add_plugins(UiPlugin)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use bevy_egui::EguiPlugin;
|
use bevy_egui::EguiPlugin;
|
||||||
|
|
||||||
use crate::{responsive_scale, CurrentScene};
|
use crate::CurrentScene;
|
||||||
|
|
||||||
pub mod lobby;
|
pub mod lobby;
|
||||||
pub mod menu;
|
pub mod menu;
|
||||||
|
@ -16,7 +16,6 @@ impl Plugin for ScenesPlugin {
|
||||||
app.add_plugins(EguiPlugin)
|
app.add_plugins(EguiPlugin)
|
||||||
.add_state::<CurrentScene>()
|
.add_state::<CurrentScene>()
|
||||||
.add_plugins(menu::MenuPlugin)
|
.add_plugins(menu::MenuPlugin)
|
||||||
.add_plugins(lobby::LobbyPlugin)
|
.add_plugins(lobby::LobbyPlugin);
|
||||||
.add_plugins(responsive_scale::ResponsiveScalingPlugin);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
19
crates/border-wars/src/ui/mod.rs
Normal file
19
crates/border-wars/src/ui/mod.rs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
//! TODO
|
||||||
|
|
||||||
|
pub mod hover;
|
||||||
|
pub mod responsive_scale;
|
||||||
|
|
||||||
|
use bevy::prelude::*;
|
||||||
|
use responsive_scale::ResponsiveScalingPlugin;
|
||||||
|
|
||||||
|
use self::hover::HoverPlugin;
|
||||||
|
|
||||||
|
/// The plugin for the UI.
|
||||||
|
pub struct UiPlugin;
|
||||||
|
|
||||||
|
impl Plugin for UiPlugin {
|
||||||
|
fn build(&self, app: &mut App) {
|
||||||
|
app.add_plugins(HoverPlugin)
|
||||||
|
.add_plugins(ResponsiveScalingPlugin);
|
||||||
|
}
|
||||||
|
}
|
|
@ -32,6 +32,7 @@ pub fn change_scaling(
|
||||||
if window.resolution.physical_height() == 0 {
|
if window.resolution.physical_height() == 0 {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let (a, b) = (
|
let (a, b) = (
|
||||||
window.resolution.width() / size.0.x,
|
window.resolution.width() / size.0.x,
|
||||||
window.resolution.height() / size.0.y,
|
window.resolution.height() / size.0.y,
|
Loading…
Reference in a new issue