Repository navigation
Loading screen: show the bar and the logo together; 20.11.1 - #1776
Merged
Merged
Conversation
The progress bar went on screen at once and the logo, decoded a frame or so later, popped in after it. The bar is now built at once (it still follows the load from the first asset) but put on screen in the same frame as the logo. It shows alone when the logo cannot be decoded, or when the game's assets finish first so the screen is not left empty for a transition. A bar torn down before it was ever shown is destroyed, dropping its LOADER_PROGRESS subscription. Also bumps melonjs and the Claude plugin to 20.11.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SeWCkETjW35ZbXDRswV1hx
hghpublic
pushed a commit
to hghpublic/melonjs-melonJS
that referenced
this pull request
Nov 19, 2026
…elonjs#1617) melonJS depended on a third-party audio library. It is now maintained in-tree under src/audio/backend, which removes the engine's last runtime dependency besides core-js and fixes a packaging wart along the way: the emitted type declarations referenced the library, so consumers type-checking with `skipLibCheck: false` had to install it themselves. The starting point was that library's unmerged TypeScript rewrite. Upstream's last release was 2.2.4 in September 2023 and the rewrite has sat open since November 2025. It carries defects the shipped 2.2.4 does not, and each one is now pinned by a regression test written against 2.2.4's behaviour: - the sound-level and voice-level create hooks shared a name and were registered into one object literal, so one silently replaced the other - pos(), orientation() and stereo() lost their group-level read path: called with no arguments they returned the sound itself, and a set with no instance id never recorded the value, so a set could not be read back - the audio context was never created before a spatial call, so pos() on a clip that had not played yet silently discarded the value - loop(loop, id) was unreachable through the types - unregistering the spatial plugin threw before cleaning anything up - pannerAttr(id) with a numeric argument was undeclared Eight fixes were also carried over from pull requests that have sat unmerged against 2.2.4, most of them mobile correctness: panner attributes shared by reference and leaking between sounds (melonjs#1758), the iOS play-after-pause race (melonjs#1761), a resume() rejection wedging the engine in "suspended" (melonjs#1764), a looping clip reporting a position past its loop end (melonjs#1776), headphone unplug leaving playback dead (melonjs#1551), a null context on low-end iOS (melonjs#1363), a queued stop() dropping its internal flag (melonjs#1648), and a backgrounded tab never resuming (melonjs#1770). Structurally, being in-tree means the layers can be honest. The plugin registry is gone — it existed so third parties could extend the library, and there was only ever one plugin, always installed; spatial audio is now part of the engine, sound and voice paths directly. Audio context creation is idempotent and belongs to the engine rather than a free function that reached into the singleton with no guard. The bundled user-agent parser is gone: it duplicated system/platform less well, missing iPadOS 13+ entirely, and the one check still reachable from it now lives there as `appleVendor`. CocoonJS support and the iOS 8 fallback are gone as unreachable. The loader keeps its own boundary. Audio is registered through a parser in loader/parsers/ like every other asset type, rather than the loader importing the audio module directly, so a future backend change cannot ripple into it. The shared fetch helper moved out of loader/parsers/ to utils/: it is engine transport, not loader policy, and its placement was the only reason the audio module had to import the loader at all. That move fixes a real bug — audio was the last asset type calling fetch() directly, so sound files failed to load when a game is served from file://, which is a Cordova or Capacitor APK on Android. Owning the code also makes capability reachable that was always there. Clips can declare sprite regions, so one download carries many effects; duration(), playing() and state() are exposed; and pool, rate, mute, preload, format and a map of lifecycle callbacks can be set at load time. play()'s second argument accepts either the original loop boolean or an options object, so every existing call form is unchanged. The backend keeps its own CHANGELOG and LICENSE, recording that it is a customized derivative rather than the upstream library. Claude-Session: https://claude.ai/code/session_012Aa37KGXZcnVrbn1yG4j1N Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The default loading screen put its progress bar on screen at once and loaded the melonJS logo in parallel. The logo is decoded a frame or so later, so on some loads the bar was drawn alone first and the logo popped in after it.
Now the bar is built at once, so it still follows the load from the first asset, but goes on screen in the same frame as the logo. It shows alone in two cases:
state.transition()to fade over. The late logo is still never added, as before.A bar torn down before it was ever shown is now destroyed directly, which drops its
LOADER_PROGRESSsubscription (the world would otherwise never destroy it).Also bumps
melonjsand.claude-plugin/plugin.jsonto 20.11.1, with the changelog entry under the 20.11.1 section #1775 opened. The loading-assets skill now says the bar and logo are added together.Verification
tests/loadingscreen.spec.js: 4 new tests (bar and logo arrive together; bar alone when the logo fails to decode; the bar tracks progress before it is shown; a never-shown bar is destroyed with its subscription). Breaking each rule in the source fails its test (4 of 4).pnpm lintpasses.Type of change
🤖 Generated with Claude Code
https://claude.ai/code/session_01SeWCkETjW35ZbXDRswV1hx