From f9bedc374ec556d5c9e8d065a29da336f1346449 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Mon, 29 Jul 2024 17:03:26 -0500 Subject: [PATCH] WIP scaling without breaking font rendering, too --- src/camera.rs | 2 +- src/main_menu.rs | 2 +- src/player.rs | 41 ++++++++++++++++++++--------------------- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index 8dbe97d..ec57286 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -3,7 +3,7 @@ use bevy::render::camera::Camera; pub fn startup(mut commands: Commands) { let mut bundle = (Camera2dBundle::default(), IsDefaultUiCamera); - bundle.0.projection.scale = 0.5; + // bundle.0.projection.scale = 1; commands.spawn(bundle); } diff --git a/src/main_menu.rs b/src/main_menu.rs index 87ce8be..a17fe01 100644 --- a/src/main_menu.rs +++ b/src/main_menu.rs @@ -26,7 +26,7 @@ pub fn startup(mut commands: Commands, assets: Res) { "Text Example\nPress ENTER to play", TextStyle { font: assets.fonts.iosevkalytemin.clone(), - font_size: 30.0, + font_size: 100.0, ..default() }, ) diff --git a/src/player.rs b/src/player.rs index bd024f6..3c30f2f 100644 --- a/src/player.rs +++ b/src/player.rs @@ -29,36 +29,35 @@ pub fn startup( let listener = SpatialListener::new(1.); commands - .spawn(( - Player, - YSortable, - Watched, - SpriteSheetBundle { - texture, - atlas: assets.images.player.clone().into(), - sprite: Sprite::default(), - ..default() - }, - Mover { - velocity: Velocity(Vec2::ZERO), - heading: Heading(Vec2::ZERO), - speed: Speed(PLAYER_SPEED), - }, - )) + .spawn((Player, YSortable, Watched)) .with_children(|player| { + player.spawn(( + SpriteSheetBundle { + texture, + transform: Transform::from_scale(Vec3::new(2., 2., 1.)), + atlas: assets.images.player.clone().into(), + sprite: Sprite::default(), + ..default() + }, + Mover { + velocity: Velocity(Vec2::ZERO), + heading: Heading(Vec2::ZERO), + speed: Speed(PLAYER_SPEED), + }, + )); player.spawn((SpatialBundle::default(), listener.clone())); - player.spawn(TextBundle { + player.spawn(Text2dBundle { text: Text::from_section( "You", TextStyle { - font_size: 100.0, + font_size: 11.0, font: assets.fonts.iosevkalytemin.clone(), color: Color::WHITE, - ..Default::default() + ..default() }, ), - transform: Transform::from_translation(Vec3::new(30.0, -30.0, -1000.0)), - ..Default::default() + transform: Transform::from_translation(Vec3::new(30.0, -30.0, 0.)), + ..default() }); let mesh = Mesh2dHandle(meshes.add(Capsule2d::new(3.0, 25.0)));