GithubHelp home page GithubHelp logo

msvbg / bevy_smooth_pixel_camera Goto Github PK

View Code? Open in Web Editor NEW

This project forked from doonv/bevy_smooth_pixel_camera

0.0 0.0 0.0 51 KB

Smooth pixel-perfect camera for Bevy

Home Page: https://crates.io/crates/bevy_smooth_pixel_camera

License: Apache License 2.0

Rust 100.00%

bevy_smooth_pixel_camera's Introduction

bevy_smooth_pixel_camera

crates.io docs.rs

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: https://youtu.be/jguyR4yJb1M

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.

    cargo add bevy_smooth_pixel_camera
  2. Add the PixelCameraPlugin and set the ImagePlugin to default_nearest.

    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.

    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 main
0.12.* / latest 0.1.0 - 0.2.1 / latest

bevy_smooth_pixel_camera's People

Contributors

doonv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.