From efc04c14a962b826b793c4b8031257660dfd83d3 Mon Sep 17 00:00:00 2001 From: mikebarkmin <2592379+mikebarkmin@users.noreply.github.com> Date: Mon, 20 Jul 2026 21:34:20 +0000 Subject: [PATCH] chore: release v4.28.2 --- .changeset/make-sprite-testable.md | 12 ------------ CHANGELOG.md | 16 +++++++++++++++- pom.xml | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) delete mode 100644 .changeset/make-sprite-testable.md diff --git a/.changeset/make-sprite-testable.md b/.changeset/make-sprite-testable.md deleted file mode 100644 index dac9de13..00000000 --- a/.changeset/make-sprite-testable.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -type: patch ---- - -`Sprite` (and therefore `AnimatedSprite`) can now be constructed and used without a running `Window`/`Applet`, which previously crashed the whole JVM via `System.exit()`. - -- **Root cause**: `Sprite()`'s constructor builds a `Text`, whose constructor eagerly loaded the library's default font through the Processing asset pipeline. With no live `Applet`, that load failed and the asset-error reporter called `System.exit()`. `Font` now defers loading the underlying font file until it is actually needed (the first `getFont()` call during rendering), instead of doing it synchronously in its constructor. This matches how the library already preloads assets in the background once a `Window` is running (`Applet.loadAssets()`), and doesn't change behavior for normal (non-test) usage. -- **`Sprite.ifOnEdgeBounce()`** used to throw a `NullPointerException` if called before the sprite was added to a stage (it read stage border fields unconditionally). It's now a no-op in that case, consistent with how other stage-dependent drawing code already guards on `stage == null`. - -Together these make it possible to unit test a `Sprite` subclass's movement/geometry logic (and now `run()`, as long as it doesn't touch other stage-dependent queries) without spinning up a real window - which is exactly what the newly added `SpriteTest`, `AnimatedSpriteTest`, and `FontTest` do. - -Note: sprites with costumes still require a live `Applet` to construct, since loading actual image pixel data (width/height) is inherent to adding a costume - this only unblocks bare `Sprite`/`AnimatedSprite` construction and costume-free logic. diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cb9053e..4ca18f6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,23 @@ --- name: Changelog -index: 59 +index: 60 lang: en --- +## 4.28.2 + + + +`Sprite` (and therefore `AnimatedSprite`) can now be constructed and used without a running `Window`/`Applet`, which previously crashed the whole JVM via `System.exit()`. + +- **Root cause**: `Sprite()`'s constructor builds a `Text`, whose constructor eagerly loaded the library's default font through the Processing asset pipeline. With no live `Applet`, that load failed and the asset-error reporter called `System.exit()`. `Font` now defers loading the underlying font file until it is actually needed (the first `getFont()` call during rendering), instead of doing it synchronously in its constructor. This matches how the library already preloads assets in the background once a `Window` is running (`Applet.loadAssets()`), and doesn't change behavior for normal (non-test) usage. +- **`Sprite.ifOnEdgeBounce()`** used to throw a `NullPointerException` if called before the sprite was added to a stage (it read stage border fields unconditionally). It's now a no-op in that case, consistent with how other stage-dependent drawing code already guards on `stage == null`. + +Together these make it possible to unit test a `Sprite` subclass's movement/geometry logic (and now `run()`, as long as it doesn't touch other stage-dependent queries) without spinning up a real window - which is exactly what the newly added `SpriteTest`, `AnimatedSpriteTest`, and `FontTest` do. + +Note: sprites with costumes still require a live `Applet` to construct, since loading actual image pixel data (width/height) is inherent to adding a costume - this only unblocks bare `Sprite`/`AnimatedSprite` construction and costume-free logic. + + ## 4.28.1 diff --git a/pom.xml b/pom.xml index cefb56c2..f2c2bc5c 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.openpatch scratch - 4.28.1 + 4.28.2 jar Scratch for Java