{"id":15017989,"url":"https://github.com/drakmaniso/bevy_pixel_camera","last_synced_at":"2025-10-11T23:32:32.035Z","repository":{"id":41816615,"uuid":"377760377","full_name":"drakmaniso/bevy_pixel_camera","owner":"drakmaniso","description":"A simple pixel-perfect camera plugin for Bevy, suitable for pixel-art.","archived":false,"fork":false,"pushed_at":"2024-07-05T15:58:49.000Z","size":94,"stargazers_count":151,"open_issues_count":5,"forks_count":18,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-28T21:07:29.996Z","etag":null,"topics":["bevy","graphics","pixel-art"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drakmaniso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-17T08:33:59.000Z","updated_at":"2025-03-12T06:26:02.000Z","dependencies_parsed_at":"2023-01-29T18:40:27.867Z","dependency_job_id":"5984e87c-a80d-4e3c-828d-19697262c468","html_url":"https://github.com/drakmaniso/bevy_pixel_camera","commit_stats":{"total_commits":66,"total_committers":14,"mean_commits":4.714285714285714,"dds":0.3787878787878788,"last_synced_commit":"564a54f5b9fba2da724821ab0f525fb3172b0c6b"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drakmaniso%2Fbevy_pixel_camera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drakmaniso%2Fbevy_pixel_camera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drakmaniso%2Fbevy_pixel_camera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drakmaniso%2Fbevy_pixel_camera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drakmaniso","download_url":"https://codeload.github.com/drakmaniso/bevy_pixel_camera/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256115,"owners_count":20909240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bevy","graphics","pixel-art"],"created_at":"2024-09-24T19:51:17.533Z","updated_at":"2025-10-11T23:32:27.015Z","avatar_url":"https://github.com/drakmaniso.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bevy_pixel_camera\n\nA simple camera plugin for the Bevy game engine, to help with the use of\npixel-art sprites.\n\nThis crates provides a plugin to automatically configure Bevy's\n`Camera2dBundle`. It works by setting the camera to an integer scaling\nfactor (using Bevy's `ScalingMode::WindowSize`), and automatically updating\nthe zoom level so that the specified target resolution fills as much of the\nsceen as possible.\n\nThe plugin can also automatically set and resize the viewport of the camera\nto match the target resolution.\n\n## Comparison with other methods\n\nThere is two main methods to render pixel-art games: upscale each sprite\nindependently, or render everything to an offscreen texture and only upscale\nthis texture. This crate use the first method. There is advantages and\ndrawbacks to both approaches.\n\nAdvantages of the \"upscale each sprite independently\" method (i.e. this\ncrate):\n\n- allows for smoother scrolling and movement of sprites, if you're willing\n  to temporarily break the alignment on virtual pixels (this would be even\n  more effective with a dedicated upscaling shader);\n- easier to mix pixel-art and high resolution graphics (for example for\n  text, particles or effects).\n\nAdvantages of the \"offscreen texture\" method:\n\n- always ensure perfect alignment on virtual pixels (authentic \"retro\"\n  look);\n- may be more efficient (in most cases, the difference is probably\n  negligible on modern computers).\n\n## How to use\n\nNote that Bevy uses linear sampling by default for textures, which is not\nwhat you want for pixel art. The easiest way to change this is to configure\nBevy's default plugins with `ImagePlugin::default_nearest()`.\n\nAlso note that if either the width or the height of your sprite is not\ndivisible by 2, you may need to change the anchor of the sprite (which is at\nthe center by default), otherwise it won't be aligned with virtual pixels.\n\n```rust\nuse bevy::prelude::*;\nuse bevy::sprite::Anchor;\nuse bevy_pixel_camera::{\n    PixelCameraPlugin, PixelZoom, PixelViewport\n};\n\nfn main() {\n    App::new()\n        .add_plugins(DefaultPlugins.set(ImagePlugin::default_nearest()))\n        .add_plugins(PixelCameraPlugin)\n        .add_systems(Startup, setup)\n        .run();\n}\n\nfn setup(\n    mut commands: Commands,\n    asset_server: Res\u003cAssetServer\u003e,\n) {\n    commands.spawn((\n        Camera2dBundle::default(),\n        PixelZoom::FitSize {\n            width: 320,\n            height: 180,\n        },\n        PixelViewport,\n    ));\n\n    commands.spawn(SpriteBundle {\n        texture: asset_server.load(\"my-pixel-art-sprite.png\"),\n        sprite: Sprite {\n            anchor: Anchor::BottomLeft,\n            ..Default::default()\n        },\n        ..Default::default()\n    });\n}\n```\n\nA small example is included in the crate. Run it with:\n\n```console\ncargo run --example flappin\n```\n\n## Bevy versions supported\n\n| bevy | bevy_pixel_camera |\n|------|-------------------|\n| 0.13 | 0.13              |\n| 0.12 | 0.12              |\n| 0.11 | 0.5.2             |\n| 0.10 | 0.4.1             |\n| 0.9  | 0.3               |\n| 0.8  | 0.2               |\n\n### Migration guide: 0.4 to 0.5 (Bevy 0.10 to 0.11)\n\nThe `PixelBorderPlugin` has been deprecated. If you want a border around\nyour virtual resolution, pass `true` to the `set_viewport` argument when\ncreating the camera bundle (see example above).\n\n### Migration guide: 0.5 to 0.12 (Bevy 0.11 to 0.12)\n\nThe `PixelCameraBundle` has been deprecated. Replace it with a standard\n`Camera2dBundle`, to which you add the `PixelZoom` and `PixelViewport`\ncomponents.\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or\n  \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or\n  \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\nLicense: MIT OR Apache-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrakmaniso%2Fbevy_pixel_camera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrakmaniso%2Fbevy_pixel_camera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrakmaniso%2Fbevy_pixel_camera/lists"}