-
Notifications
You must be signed in to change notification settings - Fork 886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add external canvas usage to RuntimeGamePixiRenderer #7199
Conversation
@@ -189,6 +189,120 @@ namespace gdjs { | |||
gameCanvas.focus(); | |||
} | |||
|
|||
useCanvas(gameCanvas: HTMLCanvasElement): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a lot of copy from the createStandardCanvas
function. Could you rework createStandardCanvas
so that it's using useCanvas
under the hood?
Also, the name is probably not showing this is an important operation enough, that just can't be redone a second time. So I think it should be called initializeForCanvas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for review! I've refactored createStandardCanvas
, renamed useCanvas
, updated runtimegame.dispose()
and added tests.
8f2b5df
to
6febb37
Compare
6febb37
to
2c2f94e
Compare
6778bc9
to
f1bc74a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Many thanks for setting up these tests, they will be helpful to ensure this continues to work in the future and that the dispose method properly get rid of DOM elements.
This PR introduces the useCanvas method in the RuntimeGamePixiRenderer class, enabling developers to provide an external canvas for rendering instead of relying on the internally created one.