Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doonv/bevy_smooth_pixel_camera
Smooth pixel-perfect camera for Bevy
https://github.com/doonv/bevy_smooth_pixel_camera
bevy bevy-plugin camera pixel pixel-perfect rust smooth
Last synced: 3 months ago
JSON representation
Smooth pixel-perfect camera for Bevy
- Host: GitHub
- URL: https://github.com/doonv/bevy_smooth_pixel_camera
- Owner: doonv
- License: apache-2.0
- Created: 2023-11-04T13:56:04.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-04T19:45:16.000Z (10 months ago)
- Last Synced: 2024-10-03T12:40:05.344Z (4 months ago)
- Topics: bevy, bevy-plugin, camera, pixel, pixel-perfect, rust, smooth
- Language: Rust
- Homepage: https://crates.io/crates/bevy_smooth_pixel_camera
- Size: 59.6 KB
- Stars: 31
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# bevy_smooth_pixel_camera
[![crates.io](https://img.shields.io/crates/v/bevy_smooth_pixel_camera)](https://crates.io/crates/bevy_smooth_pixel_camera)
[![docs.rs](https://docs.rs/bevy_smooth_pixel_camera/badge.svg)](https://docs.rs/bevy_smooth_pixel_camera)A bevy plugin that adds a simple smooth pixel camera.
The smoothing is based on this video from aarthificial which explains how it works pretty nicely:
This method allows for smooth camera movement while retaining the pixel perfection of low resolution rendering.
## Usage
1. Add the `bevy_smooth_pixel_camera` crate to your project.
```sh
cargo add bevy_smooth_pixel_camera
```2. Add the `PixelCameraPlugin` and set the `ImagePlugin` to `default_nearest`.
```rust,no_run
use bevy::prelude::*;
use bevy_smooth_pixel_camera::prelude::*;App::new().add_plugins((
DefaultPlugins.set(ImagePlugin::default_nearest()),
PixelCameraPlugin
)).run();
```3. Add a pixel pefect camera to your scene.
```rust
use bevy::prelude::*;
use bevy_smooth_pixel_camera::prelude::*;fn setup(mut commands: Commands) {
commands.spawn((
Camera2dBundle::default(),
PixelCamera::from_size(ViewportSize::PixelFixed(4))
));
}
```4. That should be it! Make sure you move your camera via the `PixelCamera.subpixel_pos` property instead of the `Transform` component.
## Bevy Compatibility
| bevy | bevy_smooth_pixel_camera |
| ----------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| [main](https://github.com/bevyengine/bevy) | [main](https://github.com/doonv/bevy_smooth_pixel_camera) |
| 0.13.* / [latest](https://github.com/bevyengine/bevy/tree/latest) | 0.3.0 / [latest](https://github.com/doonv/bevy_smooth_pixel_camera/tree/latest) |
| 0.12.* | 0.1.0 - 0.2.1 |