Skip to content

Commit

Permalink
adjust title bar height
Browse files Browse the repository at this point in the history
  • Loading branch information
foxzool committed Dec 24, 2024
1 parent beec14a commit 1ab84e9
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 59 deletions.
116 changes: 57 additions & 59 deletions src/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ fn setup_ui(
width: Val::Percent(100.0),
height: Val::Percent(100.0),
display: Display::Flex,
margin: UiRect {
top: Val::Px(24.0),
..default()
},
flex_direction: FlexDirection::Column,
justify_content: JustifyContent::FlexStart,

Expand Down Expand Up @@ -167,7 +171,6 @@ fn toolbars(
..default()
},
BorderColor(*EXTRA_LIGHT_GRAY),

))
.with_children(|builder| {
builder
Expand Down Expand Up @@ -409,77 +412,72 @@ fn left_bar(
fn title_bar(font_assets: &Res<FontAssets>, builder: &mut ChildBuilder) {
builder
.spawn((
Name::new("title-bar"),
Name::new("title-wrapper"),
Node {
display: Display::Flex,
height: Val::Px(114.0),
margin: UiRect::axes(Val::Auto, Val::Px(0.0)),
padding: UiRect {
left: Val::Px(24.0),
right: Val::Px(24.0),
top: Val::Px(26.0),
bottom: Val::Px(20.0),
},
max_width: Val::Px(1280.0),
width: Val::Px(1280.0),
align_items: AlignItems::Baseline,
..default()
},
BackgroundColor(WHITE_COLOR),
// BackgroundColor(GAME_YELLOW),
))
.with_children(|builder| {
builder
.spawn((
Name::new("title-wrapper"),
Name::new("game-title"),
Node {
display: Display::Flex,
margin: UiRect::axes(Val::Auto, Val::Px(0.0)),
padding: UiRect::all(Val::Px(24.0)),
max_width: Val::Px(1280.0),
width: Val::Px(1280.0),
align_items: AlignItems::Baseline,
margin: UiRect {
// top: Val::Px(10.0),
right: Val::Px(16.0),
..default()
},
// padding: UiRect::axes(Val::Px(5.), Val::Px(1.)),
..default()
},
// BackgroundColor(GAME_YELLOW),
// BackgroundColor(GRAY2),
))
.with_children(|builder| {
builder
.spawn((
Name::new("game-title"),
Node {
margin: UiRect {
// top: Val::Px(10.0),
right: Val::Px(16.0),
..default()
},
// padding: UiRect::axes(Val::Px(5.), Val::Px(1.)),
..default()
},
// BackgroundColor(GRAY2),
))
.with_children(|p| {
p.spawn((
Text::new("Sudoku"),
TextFont {
font_size: 42.0,
font: font_assets.karnak.clone(),
..default()
},
TextColor::BLACK,
));
});
.with_children(|p| {
p.spawn((
Text::new("Sudoku"),
TextFont {
font_size: 42.0,
font: font_assets.karnak.clone(),
..default()
},
TextColor::BLACK,
));
});

builder
.spawn((
Name::new("game-date"),
Node {
bottom: Val::Px(6.0),
// padding: UiRect::axes(Val::Px(5.), Val::Px(1.)),
..default()
},
// BackgroundColor(GRAY),
))
.with_children(|p| {
let date_str = chrono::Local::now().format("%B %d, %Y").to_string();
p.spawn((
Text::new(date_str),
TextFont {
font_size: 28.0,
font: font_assets.franklin_500.clone(),
..default()
},
TextColor::BLACK,
));
});
builder
.spawn((
Name::new("game-date"),
Node {
bottom: Val::Px(6.0),
// padding: UiRect::axes(Val::Px(5.), Val::Px(1.)),
..default()
},
// BackgroundColor(GRAY),
))
.with_children(|p| {
let date_str = chrono::Local::now().format("%B %d, %Y").to_string();
p.spawn((
Text::new(date_str),
TextFont {
font_size: 28.0,
font: font_assets.franklin_500.clone(),
..default()
},
TextColor::BLACK,
));
});
});
}
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::game::SudokuPlugin;
use crate::loading::LoadingPlugin;
use crate::menu::MenuPlugin;

use crate::color::WHITE_COLOR;
use bevy::app::App;
use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin};
use bevy::prelude::*;
Expand All @@ -32,6 +33,7 @@ pub struct GamePlugin;
impl Plugin for GamePlugin {
fn build(&self, app: &mut App) {
app.init_state::<GameState>()
.insert_resource(ClearColor(WHITE_COLOR))
.add_plugins((LoadingPlugin, MenuPlugin, SudokuPlugin));

#[cfg(debug_assertions)]
Expand Down

0 comments on commit 1ab84e9

Please sign in to comment.