bevy_pixel_camera icon indicating copy to clipboard operation
bevy_pixel_camera copied to clipboard

Drawing shapes at the right resolution

Open musjj opened this issue 2 years ago • 2 comments

For example, this draws a simple circle at the centre of the screen:

commands.spawn(MaterialMesh2dBundle {
    mesh: meshes.add(shape::Circle::new(50.).into()).into(),
    material: materials.add(ColorMaterial::from(Color::BLACK)),
    transform: Transform::from_translation(Vec3::new(0., 0., 0.)),
    ..default()
});

But this does not draw shapes at the resolution set by PixelCameraBundle. How do you adjust it so that it draws shapes at the right resolution?

musjj avatar Oct 01 '23 12:10 musjj

This is currently not possible with this crate, which can only display pixel art images (I should make that clearer in the readme).

In order to render vector shapes at low resolution, you need to use an off-screen render target. See this example in the bevy repo; the example is in 3d but the same technique should word for 2d.

I might add this functionality later, but I'm not sure when.

drakmaniso avatar Oct 02 '23 06:10 drakmaniso

Yeah, I went with the off-screen method and found it a better fit for what I'm trying to do. I'll leave this issue as is since it seems that you're open to the possibility of implementing it in the future.

musjj avatar Oct 02 '23 12:10 musjj