Deprecate legacy reshape() and improve backward compatibility#2881
Conversation
There was a problem hiding this comment.
Code Review
This pull request deprecates the legacy reshape(int, int) method in favor of reshape(int, int, int, int) to handle display size changes, updating various context implementations to call both methods for backward compatibility, and adding corresponding unit tests. The review feedback highlights potential NullPointerExceptions in OGLESContext.java during context deinitialization and suggests adding null checks for the listener object before invoking its methods.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
This marks the 2 params reshape as deprecated in favor of the new 4 params (logic+framebuffer) dpi aware hook.
It also changes the way backward compatibility is implemented, previously I made the old method redirect to the new, but this overlooked the possibility of user code overriding the reshape hook inside SimpleApplication (see here).
To properly support backward compatibility, even in this case, the engine now calls both the new and old hooks from every backend.