🤹‍ 2D sprite rendering extension for the specs ECS system

Overview

specs-blit

2D sprite rendering extension for the Specs ECS system.

CI Version Rust Documentation License

All sprites are loaded onto a big array on the heap.

Example

// Setup the specs world
let mut world = specs::World::new();

// Load the blit components into the world
world.register::<specs_blit::Sprite>();

// Add the pixel buffer as a resource so it can be accessed from the RenderSystem later
const WIDTH: usize = 800;
const HEIGHT: usize = 600;
world.insert(specs_blit::PixelBuffer::new(WIDTH, HEIGHT));

let sprite_ref = {
    // Load the image using the image crate
    let img = image::open("examples/smiley.png")?;
    // Create a sprite from it
	const MASK_COLOR: u32 = 0xFF00FF;
    let sprite = blit::blit_buffer(&img, blit::Color::from_u32(MASK_COLOR));

    // Move the sprite to the render system with 4 rotations
    specs_blit::load(sprite, 4)?
};

// Create a new sprite entity in the ECS system
world.create_entity()
	.with(specs_blit::Sprite::new(sprite_ref))
	.build();

// Setup the dispatcher with the blit system
let mut dispatcher = specs::DispatcherBuilder::new()
	.with_thread_local(specs_blit::RenderSystem)
	.build();

// Enter the render loop that should be called every frame
while render_frame() {
	// Update specs
	dispatcher.dispatch(&mut world);

	// Add/remove entities added in dispatch through `LazyUpdate`
	world.maintain();

	// Get the pixel buffer resource to render it
	let buffer = world.read_resource::<specs_blit::PixelBuffer>();
	// Render the pixel buffer
	window.update_with_buffer(&buffer.pixels(), buffer.width(), buffer.height())?;
}
Comments
  • Update actions/setup-dotnet action to v2 - autoclosed

    Update actions/setup-dotnet action to v2 - autoclosed

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | actions/setup-dotnet | action | major | v1 -> v2 |


    Release Notes

    actions/setup-dotnet

    v2

    Compare Source


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, click this checkbox.

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Configure Renovate

    Configure Renovate

    Mend Renovate

    Welcome to Renovate! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

    🚦 To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.


    Detected Package Files

    • Cargo.toml (cargo)
    • .github/workflows/rust.yml (github-actions)

    Configuration Summary

    Based on the default config's presets, Renovate will:

    • Start dependency updates only once this onboarding PR is merged
    • Enable Renovate Dependency Dashboard creation.
    • If Renovate detects semantic commits, it will use semantic commit type fix for dependencies and chore for all others.
    • Ignore node_modules, bower_components, vendor and various test/tests directories.
    • Autodetect whether to pin dependencies or maintain ranges.
    • Rate limit PR creation to a maximum of two per hour.
    • Limit to maximum 10 open PRs at any time.
    • Group known monorepo packages together.
    • Use curated list of recommended non-monorepo package groupings.
    • A collection of workarounds for known problems with packages.

    🔡 Would you like to change the way Renovate is upgrading your dependencies? Simply edit the renovate.json in this branch with your custom config and the list of Pull Requests in the "What to Expect" section below will be updated the next time Renovate runs.


    What to Expect

    With your current configuration, Renovate will create 9 Pull Requests:

    Update Rust crate anyhow to 1.0.61
    • Schedule: ["at any time"]
    • Branch name: renovate/anyhow-1.x
    • Merge into: master
    • Upgrade anyhow to 1.0.61
    Update Rust crate image to 0.24.3
    • Schedule: ["at any time"]
    • Branch name: renovate/image-0.x
    • Merge into: master
    • Upgrade image to 0.24.3
    Update Rust crate minifb to 0.23.0
    • Schedule: ["at any time"]
    • Branch name: renovate/minifb-0.x
    • Merge into: master
    • Upgrade minifb to 0.23.0
    Update Rust crate rayon to 1.5.3
    • Schedule: ["at any time"]
    • Branch name: renovate/rayon-1.x
    • Merge into: master
    • Upgrade rayon to 1.5.3
    Update Rust crate specs to 0.18.0
    • Schedule: ["at any time"]
    • Branch name: renovate/specs-0.x
    • Merge into: master
    • Upgrade specs to 0.18.0
    Update actions/checkout action to v3
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-checkout-3.x
    • Merge into: master
    • Upgrade actions/checkout to v3
    Update actions/setup-dotnet action to v2
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-setup-dotnet-2.x
    • Merge into: master
    • Upgrade actions/setup-dotnet to v2
    Update actions/setup-node action to v3
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-setup-node-3.x
    • Merge into: master
    • Upgrade actions/setup-node to v3
    Update actions/setup-python action to v4
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-setup-python-4.x
    • Merge into: master
    • Upgrade actions/setup-python to v4

    🚸 Branch creation will be limited to maximum 2 per hour, so it doesn't swamp any CI resources or spam the project. See docs for prhourlylimit for details.


    ❓ Got questions? Check out Renovate's Docs, particularly the Getting Started section. If you need any further assistance then you can also request help here.


    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Update actions/setup-dotnet action to v3

    Update actions/setup-dotnet action to v3

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | actions/setup-dotnet | action | major | v1 -> v3 |


    Release Notes

    actions/setup-dotnet

    v3

    Compare Source

    v2

    Compare Source


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Update actions/setup-python action to v4

    Update actions/setup-python action to v4

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | actions/setup-python | action | major | v1 -> v4 |


    Release Notes

    actions/setup-python

    v4

    Compare Source

    v3

    Compare Source

    v2

    Compare Source


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Update actions/setup-node action to v3

    Update actions/setup-node action to v3

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | actions/setup-node | action | major | v1 -> v3 |


    Release Notes

    actions/setup-node

    v3

    Compare Source

    v2

    Compare Source


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Update actions/checkout action to v3

    Update actions/checkout action to v3

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | actions/checkout | action | major | v1 -> v3 |


    Release Notes

    actions/checkout

    v3

    Compare Source

    v2

    Compare Source


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Update Rust crate specs to 0.18.0

    Update Rust crate specs to 0.18.0

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | specs (source) | dependencies | minor | 0.16.1 -> 0.18.0 |


    Release Notes

    slide-rs/specs

    v0.18.0

    Compare Source

    • Increase minumum rustc version to 1.56.1 because of shred and hashbrown dependencies (#​748)

    Full changelog: https://github.com/amethyst/specs/compare/v0.17.0...v0.18.0

    v0.17.0

    Compare Source

    • Deprecate error::NoError in favor of std::convert::Infallible (#​688)
    • Use #[non_exhaustive] for error::Error. Note this bumps the minimum supported rust version to 1.40 (#​688).
    • Add the derive feature that enables all derive-related smaller features (specs-derive and shred-derive currently). (#​687)

    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
  • Update Rust crate rayon to 1.6.0

    Update Rust crate rayon to 1.6.0

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | rayon | dependencies | minor | 1.3.0 -> 1.6.0 |


    Release Notes

    rayon-rs/rayon

    v1.6.0

    Compare Source

    • The minimum supported rustc is now 1.56.
    • The new IndexedParallelIterator::fold_chunks and fold_chunks_with methods work like ParallelIterator::fold and fold_with with fixed-size chunks of items. This may be useful for predictable batching performance, without the allocation overhead of IndexedParallelIterator::chunks.
    • New "broadcast" methods run a given function on all threads in the pool. These run at a sort of reduced priority after each thread has exhausted their local work queue, but before they attempt work-stealing from other threads.
      • The global broadcast function and ThreadPool::broadcast method will block until completion, returning a Vec of all return values.
      • The global spawn_broadcast function and methods on ThreadPool, Scope, and ScopeFifo will run detached, without blocking the current thread.
    • Panicking methods now use #[track_caller] to report the caller's location.
    • Fixed a truncated length in vec::Drain when given an empty range.

    Contributors

    Thanks to all of the contributors for this release!

    v1.5.3

    Compare Source

    • The new ParallelSliceMut::par_sort_by_cached_key is a stable sort that caches the keys for each item -- a parallel version of slice::sort_by_cached_key.

    v1.5.2

    Compare Source

    • The new ParallelSlice::par_rchunks() and par_rchunks_exact() iterate slice chunks in reverse, aligned the against the end of the slice if the length is not a perfect multiple of the chunk size. The new ParallelSliceMut::par_rchunks_mut() and par_rchunks_exact_mut() are the same for mutable slices.
    • The ParallelIterator::try_* methods now support std::ops::ControlFlow and std::task::Poll items, mirroring the unstable Try implementations in the standard library.
    • The ParallelString pattern-based methods now support &[char] patterns, which match when any character in that slice is found in the string.
    • A soft limit is now enforced on the number of threads allowed in a single thread pool, respecting internal bit limits that already existed. The current maximum is publicly available from the new function max_num_threads().
    • Fixed several Stacked Borrow and provenance issues found by cargo miri.

    Contributors

    Thanks to all of the contributors for this release!

    v1.5.1

    Compare Source

    • The new in_place_scope and in_place_scope_fifo are variations of scope and scope_fifo, running the initial non-Send callback directly on the current thread, rather than moving execution to the thread pool.
    • With Rust 1.51 or later, arrays now implement IntoParallelIterator.
    • New implementations of FromParallelIterator make it possible to collect complicated nestings of items.
      • FromParallelIterator<(A, B)> for (FromA, FromB) works like unzip.
      • FromParallelIterator<Either<L, R>> for (A, B) works like partition_map.
    • Type inference now works better with parallel Range and RangeInclusive.
    • The implementation of FromParallelIterator and ParallelExtend for Vec<T> now uses MaybeUninit<T> internally to avoid creating any references to uninitialized data.
    • ParallelBridge fixed a bug with threads missing available work.

    Contributors

    Thanks to all of the contributors for this release!

    v1.5.0

    Compare Source

    • Update crossbeam dependencies.
    • The minimum supported rustc is now 1.36.

    Contributors

    Thanks to all of the contributors for this release!

    v1.4.1

    Compare Source

    • The new flat_map_iter and flatten_iter methods can be used to flatten sequential iterators, which may perform better in cases that don't need the nested parallelism of flat_map and flatten.
    • The new par_drain method is a parallel version of the standard drain for collections, removing items while keeping the original capacity. Collections that implement this through ParallelDrainRange support draining items from arbitrary index ranges, while ParallelDrainFull always drains everything.
    • The new positions method finds all items that match the given predicate and returns their indices in a new iterator.

    v1.4.0

    Compare Source

    • Implemented a new thread scheduler, RFC 5, which uses targeted wakeups for new work and for notifications of completed stolen work, reducing wasteful CPU usage in idle threads.
    • Implemented IntoParallelIterator for Range<char> and RangeInclusive<char> with the same iteration semantics as Rust 1.45.
    • Relaxed the lifetime requirements of the initial scope closure.

    Contributors

    Thanks to all of the contributors for this release!

    v1.3.1

    Compare Source

    • Fixed a use-after-free race in calls blocked between two rayon thread pools.
    • Collecting to an indexed Vec now drops any partial writes while unwinding, rather than just leaking them. If dropping also panics, Rust will abort.
      • Note: the old leaking behavior is considered safe, just not ideal.
    • The new IndexedParallelIterator::step_by() adapts an iterator to step through items by the given count, like Iterator::step_by().
    • The new ParallelSlice::par_chunks_exact() and mutable equivalent ParallelSliceMut::par_chunks_exact_mut() ensure that the chunks always have the exact length requested, leaving any remainder separate, like the slice methods chunks_exact() and chunks_exact_mut().

    Contributors

    Thanks to all of the contributors for this release!


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
Releases(v0.5.1)
Owner
Thomas Versteeg
Thomas Versteeg
A light-weight Anchor-Offset based 2D sprite rendering system for the bevy engine.

Bevy AoUI A light-weight anchor-offset based 2D sprite layout system for the bevy engine. Bevy AoUI provides a light-weight rectangular anchor-offset

Mincong Lu 4 Nov 22, 2023
wecs (wckd-ecs) is a simple ECS library suitable for general use.

wecs wecs (wckd-ecs) is a simple ECS library heavily based on bevy_ecs. Motivation As part of my "Road to Rust GameDev" journey, I wanted to learn how

João Victor 9 Jul 2, 2023
A tilemap rendering crate for bevy which is more ECS friendly.

bevy_ecs_tilemap A tilemap rendering plugin for bevy which is more ECS friendly by having an entity per tile. Features A tile per entity Fast renderin

John 414 Dec 30, 2022
A sprite-sheet animation plugin for bevy

Benimator A sprite sheet animation plugin for bevy Features A SpriteSheetAnimation component to automatically update the indices of the TextureAtlasSp

Jonathan Cornaz 140 Dec 27, 2022
Explicitly set sprite layers for sprites in Bevy games.

extol_sprite_layer lets you specify the drawing order for sprites in your Bevy game using a separate component rather than via the z-coordinate of you

Ash 5 May 2, 2023
Creative Coding Framework based on Entity Component System (ECS) written in Rust

creativity creativity is Creative Coding Framework based on Entity Component System (ECS) written in Rust. Key Features TBA Quick Start TBA How To Con

Chris Ohk 9 Nov 6, 2021
High performance Rust ECS library

Legion aims to be a feature rich high performance Entity component system (ECS) library for Rust game projects with minimal boilerplate. Getting Start

Amethyst Engine 1.4k Jan 5, 2023
🏷️ Markers for Bevy ECS Entities

Bevy ECS Markers Adds the support for marking entites and fetching them in queries Example View the whole example here #[derive(EntityMarker)] enum Pl

Chopped Studio 2 Dec 23, 2022
Minimalistic implementation of entity kinds for Bevy ECS.

Bevy ?? Kindly This crate is a minimalistic implementation of Kinded Entities for Bevy game engine. In summary, it allows the user to define, construc

null 10 Jan 26, 2023
Bring Bevy's ECS to Godot4

bevy_godot4 Bring the design power of Bevy's ECS to the mature engine capabilities of Godot 4. WARNING: This crate is very early in development, and i

JR 4 May 8, 2023
A direct ecs to low-level server implementation for Godot 4.1

godot_ecs What if Godot 4.1 and Bevy got married? Well, you'd get one interesting duo of data driven goodness. In Development This crate is not produc

null 5 Oct 6, 2023
A simple type safety solution for Bevy ECS.

?? Moonshine Kind A simple type safety solution for Bevy ECS. Overview An Entity is a generic way to reference entities within Bevy ECS: #[derive(Comp

null 8 Nov 3, 2023
grr and rust-gpu pbr rendering

grr-gltf Barebone gltf viewer using grr and rust-gpu. Currently only supports a single gltf model! Assets These files need to be downloaded and placed

Markus Siglreithmaier 28 Dec 2, 2022
Vulkan rendering sandbox for raytracing

sol-rs ☀ sol-rs is a small rendering toolkit for Vulkan, with a focus on real-time raytracing (which is not currently available via other APIs such as

Éric Renaud-Houde 65 Dec 7, 2022
Text Renderer written in Rust using HarfBuzz for shaping, FreeType for rasterization and OpenGL for rendering.

Provok Text Renderer written in Rust using HarfBuzz for shaping, FreeType for rasterization and OpenGL for rendering. Input Provok is fed with a JSON

Ossama Hjaji 67 Dec 10, 2022
Proof-of-concept of getting OpenXR rendering support for Bevy game engine using gfx-rs abstractions

Introduction Proof-of-concept of getting OpenXR rendering support for Bevy game engine using gfx-rs abstractions. (hand interaction with boxes missing

Mika 52 Nov 14, 2022
Self Study on developing a game engine using wgpu as the rendering API. Learning as I go.

Fabled Engine Any issues, enhancement, features, or bugs report are always welcome in Issues. The obj branch is where frequent development and up to d

Khalid 20 Jan 5, 2023
Collection of rust crates providing rendering abstractions.

render-rs License Licensed under either of Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) MIT license (LIC

Graham Wihlidal 31 Aug 25, 2022
Cross platform rendering in Rust

Miniquad Miniquad is a manifestation of a dream in a world where we do not need a deep dependencies tree and thousands lines of code to draw things wi

Fedor Logachev 937 Jan 4, 2023