You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good catch. The notes below are for anyone who wants to tackle this.
sizeChanged also needs to be called on displayables if the size changes when the item is not visible, just before it becomes visible (deferred) and immediately if the item is visible when the size changes.
Covering Canvas, Screen, etc. shouldn't be too difficult. There are a few different ways this could be handled, though the simplest is probably just to track the last known size in each Displayable. For deferred calls, we can check that size against the current size and make the call (and update the size) when one of the Display.setCurrent methods is called. We can initially set the size to negative values to ensure that sizeChanged is called the first time a Displayable is shown. When the size changes, these should be updated in the current Displayable before calling sizeChanged so that it isn't unnecessarily called the next time it's shown.
Form complicates things as it contains other Displayables and changes to its internal size (like from adding a title) will affect its children. As sizeChanged is expected to be overwritten, we'll also need a helper method that we can call instead of sizeChanged added to Displayable to do whatever needs to be done internally, such as calling the sizeChanged helper on any child elements. All the Form stuff needs completely overhauled anyway as it was just minimally hacked together to allow a few games can start, so that part of it can probably wait.
https://docs.oracle.com/javame/config/cldc/ref-impl/midp2.0/jsr118/javax/microedition/lcdui/Displayable.html#sizeChanged(int,%20int)
"This method is called at least once before the Displayable is shown for the first time."
The text was updated successfully, but these errors were encountered: