Skip to main content

Crate retroglyph_software

Crate retroglyph_software 

Source
Expand description

CPU rasterization backend: renders grid cells into a pixel buffer and blits it to a window surface via softbuffer.

§Architecture

SoftwareBackend holds configuration only (font chain, grid size, scale); it does not implement Backend. Call into_renderer to build a SoftwareRenderer, which does the actual rendering work:

SoftwareBackend (config: font chain, grid size, scale)
  |  .into_renderer()
  v
SoftwareRenderer
  implements retroglyph_core::{Output, Input, Cursor} (= Backend)
  implements retroglyph_window::Presenter (an Output supertrait)
  |                                |
  |                                v
  |                     wrapped in retroglyph_window::WindowBackend,
  |                     driven by a windowing loop (retroglyph-window's
  |                     winit integration, or any other source of
  |                     raw window handles)
  v                                |
Terminal<SoftwareRenderer>          v
(headless / pixel tests,   softbuffer::Surface -> OS window
 inspect via .pixels())

This crate does not depend on winit. SoftwareRenderer implements Presenter against raw window handles (WindowHandle), so anything that produces those (winit via retroglyph-window, or another windowing library) can drive it. Because Presenter is an Output supertrait, SoftwareRenderer’s single Output implementation satisfies both Backend’s output half and Presenter directly, with no duplicated method bodies. retroglyph-window’s WindowBackend wraps a Presenter to provide the full Backend for windowed use, owning the input event queue that this crate does not.

For headless use (in-memory rendering, pixel-level tests) skip windowing entirely: SoftwareRenderer implements Output, Input, and Cursor directly (bundled as Backend), so Terminal<SoftwareRenderer> works without a window, and pixels gives direct access to the rendered buffer.

§Features

This crate has no default features; every feature below is optional and off unless enabled.

§default-font

⚪ Optional.

Embeds the Unscii 16 bitmap font as a ready-to-use default FontChain.

Forwards to retroglyph-window’s default-font feature.

§dev

⚪ Optional.

Forwards retroglyph-core’s dev feature, which forces development diagnostics on in a build that would otherwise compile them out (see retroglyph_core::dev).

§tilesets

⚪ Optional.

PNG sprite sheet tilesets with alpha-blended CPU blit support.

Adds alpha-blend and forwards to retroglyph-window’s tilesets feature for decode/config.

Re-exports§

pub use config::SoftwareBackend;
pub use config::SoftwareBackendBuilder;
pub use config::SoftwareBackendError;

Modules§

config
Configuration, builder, and error types for the software rendering backend.
sprite_cache
Decoded sprite cache: sprite sheet decoding, tile extraction, and runtime lookup.
tileset
Tileset configuration: codepage mappings, options, builder, and error types.

Structs§

BitmapFont
A 1-bit-per-pixel bitmap glyph font.
FontChain
The glyph source a backend draws from: a primary BitmapFont plus an ordered list of fallback fonts.
SoftwareRenderer
A running software renderer, produced by SoftwareBackend::into_renderer.

Enums§

SurfaceError
Errors creating or presenting the native window surface.