Repository navigation
Refactor/engine canvas size - #78
Merged
Merged
Conversation
The CMS integration was already fully commented out at the call sites, leaving the client, adapters, mappers and preview pages unreferenced. Removing them frees next.config.ts from the /admin rewrite, so the app can build with `output: "export"` and be published straight to Pages.
The context fetched /shaders/*.glsl at init, so the engine only worked when the host app served those files from its public folder. Shipping the sources as constants makes initWebGLContext synchronous and lets a consumer override them through Manager.setShaders.
Covers World, Entity, MessageBus, the physics/collision/particle systems and BaseGame before the architecture refactor. The tests pin down current behaviour, including the quirks worth fixing later, so the next phases have a safety net.
Deploy only triggers on the prod branch, which lags behind main, so nothing verified the workspace on the way in.
The third positional argument is mass, not angular velocity, so every asteroid got a near-zero mass and none of them rotated.
…ndow The context read `window.innerWidth/innerHeight` and registered a `resize` listener it never removed, so every new context piled up another listener holding the old one alive, and `GameConfig.canvasWidth/canvasHeight` were dead fields nobody read. Sizing now goes through a `CanvasSizeSource`: `elementCanvasSize` (default) follows the canvas element's own layout box with a `ResizeObserver`, and `fixedCanvasSize` pins the drawing buffer. `WebGLContext.dispose()` tears the subscription down, `clearWebGLContext` calls it, and `Manager` builds a fixed source when the game declares both canvas dimensions. A guard test fails the suite if any engine module reaches for a host global again. Closes #59 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`inset-0` leaves a replaced element at its intrinsic size, so the canvas was only viewport-sized because the engine kept writing `window.innerWidth` into its width attribute. Now that the engine sizes the drawing buffer from the layout box, the page has to declare that box: `w-screen h-screen`. Asteroids drops its 800x600 default for the same reason — the canvas covers the page, so the context should follow the element instead of a fixed size. Co-Authored-By: Claude Opus 5 <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.
No description provided.