/* * This file is part of sdbclient * Copyright (C) 2022 Jonni Liljamo * * Licensed under GPL-3.0-only. * See LICENSE for licensing information. */ use bevy::{ prelude::*, ui::{JustifyContent, Size, Style, Val}, }; use super::{MenuButtonAction, NORMAL_BUTTON, TEXT_COLOR}; /// Tag component for tagging entities on settings misc screen #[derive(Component)] pub struct OnSettingsMiscScreen; pub fn settings_misc_setup(mut commands: Commands, asset_server: Res) { let button_style = Style { size: Size::new(Val::Px(200.0), Val::Px(65.0)), margin: UiRect::all(Val::Px(20.0)), justify_content: JustifyContent::Center, align_items: AlignItems::Center, ..default() }; let button_text_style = TextStyle { font: asset_server.load("fonts/FiraMono-Regular.ttf"), font_size: 40.0, color: TEXT_COLOR, }; commands .spawn(( NodeBundle { style: Style { size: Size::new(Val::Percent(100.0), Val::Percent(100.0)), align_items: AlignItems::Center, justify_content: JustifyContent::Center, ..default() }, ..default() }, OnSettingsMiscScreen, )) .with_children(|parent| { parent .spawn(NodeBundle { style: Style { flex_direction: FlexDirection::Column, align_items: AlignItems::Center, ..default() }, background_color: Color::GRAY.into(), ..default() }) .with_children(|parent| { for (action, text) in [(MenuButtonAction::BackToSettings, "Back")] { parent .spawn(( ButtonBundle { style: button_style.clone(), background_color: NORMAL_BUTTON.into(), ..default() }, action, )) .with_children(|parent| { parent.spawn(TextBundle::from_section( text, button_text_style.clone(), )); }); } }); }); }