BIN
crates/border-wars/assets/border_wars.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
crates/border-wars/assets/button.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 4 KiB |
Before Width: | Height: | Size: 205 KiB |
BIN
crates/border-wars/assets/bw_menu_bg.png
Normal file
After Width: | Height: | Size: 309 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 2.2 KiB |
BIN
crates/border-wars/assets/host_icon.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
crates/border-wars/assets/info.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 1.9 KiB |
BIN
crates/border-wars/assets/join_icon.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
crates/border-wars/assets/setting.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
crates/border-wars/assets/trait.png
Normal file
After Width: | Height: | Size: 728 B |
|
@ -10,9 +10,9 @@ pub struct MenuPlugin;
|
|||
impl Plugin for MenuPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_systems(OnEnter(CurrentScene::Menu), menu_ui);
|
||||
app.add_systems(Update, change_scaling);
|
||||
app.add_systems(Update, hover_system);
|
||||
app.add_systems(Update, pressed_system);
|
||||
// app.add_systems(Update, change_scaling);
|
||||
// app.add_systems(Update, hover_system);
|
||||
// app.add_systems(Update, pressed_system);
|
||||
app.add_systems(OnExit(CurrentScene::Menu), destroy_menu);
|
||||
}
|
||||
}
|
||||
|
@ -33,9 +33,8 @@ struct MenuEntity;
|
|||
|
||||
/// Display the UI of the menu to host a game or join one.
|
||||
fn menu_ui(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
|
||||
commands
|
||||
.spawn(NodeBundle {
|
||||
.spawn(ImageBundle {
|
||||
style: Style {
|
||||
margin: UiRect::all(Val::Auto),
|
||||
width: Val::Px(1280.),
|
||||
|
@ -43,6 +42,7 @@ fn menu_ui(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
flex_direction: FlexDirection::Column,
|
||||
..default()
|
||||
},
|
||||
image: asset_server.load("bw_menu_bg.png").into(),
|
||||
z_index: ZIndex::Local(0),
|
||||
..default()
|
||||
})
|
||||
|
@ -59,8 +59,8 @@ fn menu_ui(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
CurrentScene::Setting,
|
||||
&mut commands,
|
||||
HoveredTexture {
|
||||
texture: asset_server.load("button_settings_icon.png"),
|
||||
hovered_texture: asset_server.load("button_settings_icon_hover.png"),
|
||||
texture: asset_server.load("setting.png"),
|
||||
hovered_texture: asset_server.load("setting.png"),
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -74,8 +74,8 @@ fn menu_ui(mut commands: Commands, asset_server: Res<AssetServer>) {
|
|||
CurrentScene::Lobby,
|
||||
&mut commands,
|
||||
HoveredTexture {
|
||||
texture: asset_server.load("button_menu_icon.png"),
|
||||
hovered_texture: asset_server.load("button_menu_icon_hover.png"),
|
||||
texture: asset_server.load("info.png"),
|
||||
hovered_texture: asset_server.load("info.png"),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ fn create_side_button(
|
|||
commands
|
||||
.spawn(ButtonBundle {
|
||||
style: Style {
|
||||
width: Val::Px(75.),
|
||||
width: Val::Px(53.),
|
||||
aspect_ratio: Some(1.),
|
||||
margin,
|
||||
..default()
|
||||
|
@ -111,8 +111,8 @@ fn create_button(
|
|||
commands
|
||||
.spawn(ButtonBundle {
|
||||
style: Style {
|
||||
width: Val::Px(266.),
|
||||
height: Val::Px(70.),
|
||||
width: Val::Px(297.),
|
||||
height: Val::Px(40.),
|
||||
margin: UiRect::all(Val::Auto),
|
||||
..default()
|
||||
},
|
||||
|
@ -156,7 +156,7 @@ fn default_style() -> Style {
|
|||
Style {
|
||||
flex_direction: FlexDirection::Column,
|
||||
width: Val::Percent(100.),
|
||||
height: Val::Percent(55.),
|
||||
height: Val::Percent(40.),
|
||||
margin: UiRect::all(Val::Auto),
|
||||
..default()
|
||||
}
|
||||
|
@ -167,17 +167,17 @@ fn main_node(main_node: &mut ChildBuilder<'_, '_, '_>, asset_server: &Res<AssetS
|
|||
main_node
|
||||
.spawn(ImageBundle {
|
||||
style: Style {
|
||||
height: Val::Px(150.),
|
||||
width: Val::Px(613.5),
|
||||
height: Val::Px(78.),
|
||||
width: Val::Px(614.),
|
||||
margin: UiRect {
|
||||
left: Val::Auto,
|
||||
right: Val::Auto,
|
||||
top: Val::Px(25.),
|
||||
bottom: Val::Px(50.),
|
||||
bottom: Val::Px(25.),
|
||||
},
|
||||
..default()
|
||||
},
|
||||
image: asset_server.load("bw.png").into(),
|
||||
image: asset_server.load("border_wars.png").into(),
|
||||
..default()
|
||||
})
|
||||
.insert(MenuEntity);
|
||||
|
@ -189,8 +189,8 @@ fn main_node(main_node: &mut ChildBuilder<'_, '_, '_>, asset_server: &Res<AssetS
|
|||
margin: UiRect {
|
||||
left: (Val::Auto),
|
||||
right: (Val::Auto),
|
||||
top: (Val::Auto),
|
||||
bottom: (Val::Px(25.)),
|
||||
top: (Val::Px(25.)),
|
||||
bottom: (Val::Auto),
|
||||
},
|
||||
width: Val::Px(500.),
|
||||
height: Val::Percent(65.),
|
||||
|
@ -208,16 +208,58 @@ fn main_node(main_node: &mut ChildBuilder<'_, '_, '_>, asset_server: &Res<AssetS
|
|||
.with_children(|host| {
|
||||
host.spawn(NodeBundle {
|
||||
style: default_style(),
|
||||
background_color: BackgroundColor(Color::YELLOW),
|
||||
..default()
|
||||
})
|
||||
.insert(MenuEntity);
|
||||
.insert(MenuEntity)
|
||||
.with_children(|ui| {
|
||||
ui.spawn(NodeBundle {
|
||||
style: Style {
|
||||
flex_direction: FlexDirection::Row,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
})
|
||||
.with_children(|ui2| {
|
||||
ui2.spawn(ImageBundle {
|
||||
style: Style {
|
||||
height: Val::Px(41.),
|
||||
width: Val::Px(51.),
|
||||
margin: UiRect {
|
||||
left: Val::Px(0.),
|
||||
right: Val::Px(15.),
|
||||
top: Val::Px(0.),
|
||||
bottom: Val::Px(0.),
|
||||
},
|
||||
..default()
|
||||
},
|
||||
image: asset_server.load("host_icon.png").into(),
|
||||
..default()
|
||||
});
|
||||
ui2.spawn(ImageBundle {
|
||||
style: Style {
|
||||
height: Val::Px(41.),
|
||||
width: Val::Px(115.),
|
||||
..default()
|
||||
},
|
||||
image: asset_server.load("host.png").into(),
|
||||
..default()
|
||||
});
|
||||
});
|
||||
ui.spawn(ImageBundle {
|
||||
style: Style {
|
||||
margin: UiRect::all(Val::Auto),
|
||||
..default()
|
||||
},
|
||||
image: asset_server.load("trait.png").into(),
|
||||
..default()
|
||||
});
|
||||
});
|
||||
create_button(
|
||||
CurrentScene::Lobby,
|
||||
host,
|
||||
HoveredTexture {
|
||||
texture: asset_server.load("host.png"),
|
||||
hovered_texture: asset_server.load("host.png"),
|
||||
texture: asset_server.load("button.png"),
|
||||
hovered_texture: asset_server.load("button.png"),
|
||||
},
|
||||
)
|
||||
});
|
||||
|
@ -231,16 +273,58 @@ fn main_node(main_node: &mut ChildBuilder<'_, '_, '_>, asset_server: &Res<AssetS
|
|||
.with_children(|join| {
|
||||
join.spawn(NodeBundle {
|
||||
style: default_style(),
|
||||
background_color: BackgroundColor(Color::YELLOW),
|
||||
..default()
|
||||
})
|
||||
.insert(MenuEntity);
|
||||
.insert(MenuEntity)
|
||||
.with_children(|ui| {
|
||||
ui.spawn(NodeBundle {
|
||||
style: Style {
|
||||
flex_direction: FlexDirection::Row,
|
||||
..default()
|
||||
},
|
||||
..default()
|
||||
})
|
||||
.with_children(|ui2| {
|
||||
ui2.spawn(ImageBundle {
|
||||
style: Style {
|
||||
height: Val::Px(33.),
|
||||
width: Val::Px(51.),
|
||||
margin: UiRect {
|
||||
left: Val::Px(0.),
|
||||
right: Val::Px(15.),
|
||||
top: Val::Auto,
|
||||
bottom: Val::Auto,
|
||||
},
|
||||
..default()
|
||||
},
|
||||
image: asset_server.load("join_icon.png").into(),
|
||||
..default()
|
||||
});
|
||||
ui2.spawn(ImageBundle {
|
||||
style: Style {
|
||||
height: Val::Px(41.),
|
||||
width: Val::Px(115.),
|
||||
..default()
|
||||
},
|
||||
image: asset_server.load("join.png").into(),
|
||||
..default()
|
||||
});
|
||||
});
|
||||
ui.spawn(ImageBundle {
|
||||
style: Style {
|
||||
margin: UiRect::all(Val::Auto),
|
||||
..default()
|
||||
},
|
||||
image: asset_server.load("trait.png").into(),
|
||||
..default()
|
||||
});
|
||||
});
|
||||
create_button(
|
||||
CurrentScene::Game,
|
||||
join,
|
||||
HoveredTexture {
|
||||
texture: asset_server.load("join.png"),
|
||||
hovered_texture: asset_server.load("join.png"),
|
||||
texture: asset_server.load("button.png"),
|
||||
hovered_texture: asset_server.load("button.png"),
|
||||
},
|
||||
)
|
||||
});
|
||||
|
|