pixels

repository·main·Indexed 24 days ago

https://github.com/parasyte/pixels

A tiny Rust library providing a hardware-accelerated, GPU-powered pixel frame buffer for rendering to a window. Version 0.17.2. It utilizes wgpu for acceleration and supports integration with windowing libraries like winit and tao, as well as GUI frameworks like egui and imgui. It is compatible with native targets, Android, and Web (WebGL2).

Tokens
4.9K
Snippets
22
Records
39
Agent score
85%

What's inside pixels

  1. Overview of the minimal-winit example

    main
    The minimal-winit example demonstrates the absolute minimum requirements for creating a window and a pixel buffer using the winit library. It features a simple animation of a purple box moving on a blue background. This example utilizes winit_input_helper to manage input and improve code presentation.
  2. Architecture of the Pixel Invaders example

    main

    The Pixel Invaders example is structured as a glue layer between game logic, windowing, and rendering:

    1. Game Logic: Uses the simple-invaders crate for all game state and drawing logic.
    2. Windowing & Input: Uses winit to manage the event loop and handle keyboard/gamepad input.
    3. Rendering: The winit event loop drives the simple-invaders state and rasterizes frames. The pixels crate then takes the resulting frame buffer and sends it to the screen (optionally through render passes).
  3. Use tao for window and event handling in Pixels

    main
    The minimal-tao example demonstrates how to integrate tao with the pixels crate for window management and event handling. This approach is an alternative to winit and is used to implement native features like a menubar (e.g., adding a "File > Quit" menu item).
  4. Build minimal-winit-android using Docker

    main

    If you do not want to install the Android SDK and dependencies locally, you can use the provided Containerfile to perform containerized builds. These commands should be executed from the repository root directory.

    1. Build the Docker image.
    2. Run the container to build the package. The resulting APKs will be located in ./target/debug/apk/ (or ./target/release/apk/ for release builds).