Versions

Version 2.2 (2026-09-19)

Full Version

Includes all features: graphics, input handling (keyboard, mouse, touch, gamepad), and audio plugins.

Lite Version

Graphics-only build. Smaller file size, perfect for visual-only projects.

Changelog

**Added**

- Host-controlled canvas layout via `screen()` `noCss` option. With `noCss: true`, Pi.js appends and sizes the canvas but leaves layout CSS to the host.
- WebGL context recovery: screens sharing a lost context suspend together; on restoration they rebuild GPU resources and resume with transparent framebuffers. Applications must redraw after restoration.
- Polygons plugin included with the full version.

**Changed**

- `loadImage()` and `loadSpritesheet()` no longer accept `usePalette` or `paletteKeys`. Images retain source colors when screen palettes change. No compatibility shim is provided.
- Custom `sampler2D` inputs now align with `u_texture`. Remove any `1.0 - uv.y` workaround previously applied only to custom image maps.
- Transparent composition is consistent across drawing, layers, and contexts. `ready()` callbacks run asynchronously; input cancellation resolves with `null`.

**Fixed**

- Screen removal and selection keep global commands bound to the active surviving screen. Failed screen creation rolls back cleanly.
- Mouse and touch coordinates account for CSS scaling, borders, padding, and scrolling. Large draws use bounded batches; full-turn arcs match circles.
- Image, font, audio, and plugin lifecycle edge cases around removal, late events, and failed initialization.

**Performance**

- Cached static images and sprites avoid unnecessary WebGL state queries. Triangle and line geometry use bounded reserves and copies.

Version 2.1 (2026-08-25)

Full Version

Includes all features: graphics, input handling (keyboard, mouse, touch, gamepad), and audio plugins.

Lite Version

Graphics-only build. Smaller file size, perfect for visual-only projects.

Changelog

**Added**

- Custom GLSL ES 3.00 fragment shaders can be created with `createShader()` and applied in draw order with `applyShader()`.
- Display shaders can be set with `setDisplayShader()` for effects such as custom upscaling, color grading, and CRT simulation. Persistent uniforms can be updated with `setDisplayShaderUniforms()`.
- Custom shaders support reflected float, integer, unsigned integer, boolean, vector, matrix, uniform-array, and `sampler2D` image inputs. Samplers accept registered images, direct browser image sources, and Pi screens.
- `getShaderInfo()` reports global and per-screen shader lifecycle and reflection diagnostics. `removeShader()` completes queued passes, clears active display uses, and releases cached WebGL programs.
- Nested drawing views can be managed with `pushView()`, `popView()`, and `resetView()`. Drawing, images, pixels, paint operations, clearing, and text output honor the active view's origin and clipping rectangle.
- `viewToScreen()` and `screenToView()` convert coordinates between the active view and the logical screen.
- Added a parent parameter to the screen command that enables fast `drawImage()` calls directly from the offscreen framebuffer.

**Fixed**

- Drawing an offscreen screen as an image no longer reverses its Y axis when the source and destination share a WebGL context.
- Removing images now releases their WebGL textures, and temporary framebuffers used for texture copies are reused and cleaned up with their screen.

Version 2.0 (2025-12-14)

Full Version

Includes all features: graphics, input handling (keyboard, mouse, touch, gamepad), and audio plugins.

Lite Version

Graphics-only build. Smaller file size, perfect for visual-only projects.

Changelog

- Added WebGL context for all graphics.
- Added esm source file.
- Split into full and lite versions.

Version 1.2 (2025-12-12)

Full Version

Includes all features: graphics, input handling (keyboard, mouse, touch, gamepad), and audio plugins.

Changelog

- Added getImage method
- Added removeImage method
- Removed duplicate method point
- Added cache to getImageData.
- Added parameter: isAddToPalette for get method.
- Updated internal font size calculations.
- Changed the blend mode name from blended to blend.