WIP scaling without breaking font rendering, too

This commit is contained in:
Daniel Flanagan 2024-07-29 17:03:26 -05:00
parent 4c7e259537
commit f9bedc374e
3 changed files with 22 additions and 23 deletions

View file

@ -3,7 +3,7 @@ use bevy::render::camera::Camera;
pub fn startup(mut commands: Commands) { pub fn startup(mut commands: Commands) {
let mut bundle = (Camera2dBundle::default(), IsDefaultUiCamera); let mut bundle = (Camera2dBundle::default(), IsDefaultUiCamera);
bundle.0.projection.scale = 0.5; // bundle.0.projection.scale = 1;
commands.spawn(bundle); commands.spawn(bundle);
} }

View file

@ -26,7 +26,7 @@ pub fn startup(mut commands: Commands, assets: Res<AssetLoader>) {
"Text Example\nPress ENTER to play", "Text Example\nPress ENTER to play",
TextStyle { TextStyle {
font: assets.fonts.iosevkalytemin.clone(), font: assets.fonts.iosevkalytemin.clone(),
font_size: 30.0, font_size: 100.0,
..default() ..default()
}, },
) )

View file

@ -29,36 +29,35 @@ pub fn startup(
let listener = SpatialListener::new(1.); let listener = SpatialListener::new(1.);
commands commands
.spawn(( .spawn((Player, YSortable, Watched))
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),
},
))
.with_children(|player| { .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((SpatialBundle::default(), listener.clone()));
player.spawn(TextBundle { player.spawn(Text2dBundle {
text: Text::from_section( text: Text::from_section(
"You", "You",
TextStyle { TextStyle {
font_size: 100.0, font_size: 11.0,
font: assets.fonts.iosevkalytemin.clone(), font: assets.fonts.iosevkalytemin.clone(),
color: Color::WHITE, color: Color::WHITE,
..Default::default() ..default()
}, },
), ),
transform: Transform::from_translation(Vec3::new(30.0, -30.0, -1000.0)), transform: Transform::from_translation(Vec3::new(30.0, -30.0, 0.)),
..Default::default() ..default()
}); });
let mesh = Mesh2dHandle(meshes.add(Capsule2d::new(3.0, 25.0))); let mesh = Mesh2dHandle(meshes.add(Capsule2d::new(3.0, 25.0)));