Skip to content

Commit

Permalink
Adjust font size for das label.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramirisu committed Sep 24, 2024
1 parent 730d829 commit 686e96b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/game/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub enum PlayerPhase {
pub struct PlayerData {
pub next_piece_hint: NextPieceHint,
pub board: Board,
pub game_stopwatch: Stopwatch,
pub stopwatch: Stopwatch,
pub game_timer: GameTimer,
pub lock_curr_piece_immediately: bool,
pub can_press_down: bool,
Expand All @@ -39,7 +39,7 @@ impl PlayerData {
Self {
next_piece_hint: config.next_piece_hint,
board: Board::new(config.start_level, config.transition),
game_stopwatch: Stopwatch::new(),
stopwatch: Stopwatch::new(),
game_timer: GameTimer::default(),
lock_curr_piece_immediately: false,
can_press_down: false,
Expand Down
16 changes: 8 additions & 8 deletions src/game/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub fn setup(app: &mut App) {
(
(
(
increase_game_stopwatch_system,
increase_stopwatch_system,
state_game_running::tick_system,
state_game_running::handle_input_system,
state_game_running::curr_piece_fall_system,
Expand All @@ -49,14 +49,14 @@ pub fn setup(app: &mut App) {
.chain()
.run_if(in_state(PlayerPhase::Dropping)),
(
increase_game_stopwatch_system,
increase_stopwatch_system,
state_game_line_clear::tick_system,
update_statistics_system,
)
.chain()
.run_if(in_state(PlayerPhase::LineClear)),
(
increase_game_stopwatch_system,
increase_stopwatch_system,
state_game_entry_delay::tick_system,
)
.run_if(in_state(PlayerPhase::EntryDelay)),
Expand Down Expand Up @@ -321,7 +321,7 @@ fn setup_screen(
..default()
},
TextSection::from_style(TextStyle {
font_size: game_transform.scale() * 36.0,
font_size: game_transform.scale() * 48.0,
color: WHITE.into(),
..default()
}),
Expand Down Expand Up @@ -350,7 +350,7 @@ fn setup_screen(
..default()
}),
]),
transform: Transform::from_translation(game_transform.game_stopwatch_translation()),
transform: Transform::from_translation(game_transform.stopwatch_translation()),
..default()
},
GameEntityMarker,
Expand Down Expand Up @@ -478,8 +478,8 @@ fn setup_screen(
});
}

fn increase_game_stopwatch_system(time: Res<Time>, mut player_data: ResMut<PlayerData>) {
player_data.game_stopwatch.tick(time.delta());
fn increase_stopwatch_system(time: Res<Time>, mut player_data: ResMut<PlayerData>) {
player_data.stopwatch.tick(time.delta());
}

fn update_statistics_system(
Expand Down Expand Up @@ -538,7 +538,7 @@ fn update_statistics_system(
}
}
if let Ok(mut text) = query.p5().get_single_mut() {
text.sections[1].value = format_hhmmss(player_data.game_stopwatch.elapsed());
text.sections[1].value = format_hhmmss(player_data.stopwatch.elapsed());
}
for (mut text, piece) in query.p6().iter_mut() {
text.sections[0].value = format!("{:03}", player_data.board.get_piece_count(piece.0));
Expand Down
18 changes: 14 additions & 4 deletions src/game/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ impl GameTransform {
Vec2::new(self.square_width(), self.square_height())
}

fn border_width(&self) -> f32 {
self.scale * 2.0
}

pub fn board_translation(&self) -> Vec3 {
Vec3::new(0.0, 0.0, BOARD_LAYER)
}
Expand All @@ -51,11 +55,14 @@ impl GameTransform {
}

pub fn board_background_size(&self) -> Vec2 {
Vec2::new(self.board_width() * 1.01, self.board_height() * 1.0025)
Vec2::new(
self.board_width() + self.border_width() * 2.0,
self.board_height() + self.border_width(),
)
}

pub fn board_background_translation(&self) -> Vec3 {
Vec3::new(0.0, -self.board_height() * 0.0025, BOARD_BACKGROUND_LAYER)
Vec3::new(0.0, -self.border_width(), BOARD_BACKGROUND_LAYER)
}

pub fn board_cover_size(&self) -> Vec2 {
Expand Down Expand Up @@ -102,7 +109,7 @@ impl GameTransform {
Vec3::new(self.board_width(), -self.square_height() * 8.0, BOARD_LAYER)
}

pub fn game_stopwatch_translation(&self) -> Vec3 {
pub fn stopwatch_translation(&self) -> Vec3 {
Vec3::new(
self.board_width(),
-self.square_height() * 10.0,
Expand Down Expand Up @@ -134,7 +141,10 @@ impl GameTransform {
}

pub fn next_piece_slot_background_size(&self) -> Vec2 {
Vec2::new(self.square_width() * 5.1, self.square_height() * 5.1)
Vec2::new(
self.square_width() * 5.0 + self.border_width() * 2.0,
self.square_height() * 5.0 + self.border_width() * 2.0,
)
}

pub fn statistics_translation(&self) -> Vec3 {
Expand Down

0 comments on commit 686e96b

Please sign in to comment.