Skip to content

wandbrandon/bevy_authentic_pixel_camera

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bevy_pixel_perfect_camera

A simple example using the bevy_authentic_pixel_camera plugin to achieve pixel-perfect rendering in a Bevy game.

Most pixel art camera plugins use a modern pixel camera, which doesn't force pixel perfection. Allowing for smooth movement. This is the original chunky style from old consoles.

Features

  • Pixel-perfect viewport for authentic pixel art rendering
  • Uses Bevy's nearest neighbor image filtering

Example

use bevy::prelude::*;
use bevy_authentic_pixel_camera::PixelViewportPlugin;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins.set(ImagePlugin::default_nearest()))
        .add_plugins(PixelViewportPlugin {
            width: 30,
            height: 30,
            ..Default::default()
        })
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands.spawn((Sprite {
        image: asset_server.load("bevy_pixel_dark.png"),
        ..Default::default()
    },));
}

Usage

  1. Add bevy_authentic_pixel_camera to your Cargo.toml.
  2. Use PixelViewportPlugin to set your desired pixel viewport size.
  3. Set Bevy's image plugin to use nearest neighbor filtering for crisp pixel art.

Resources

About

A relatively simple, authentic pixel-perfect camera plugin for Bevy, meant for true retro styled games.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages