Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with _Resize
#6
The reason for the delay is because a lot of our screen stuff is set up via its own independent processing thread.  

_RESIZE is basically just setting a variable for us, which is then handled with the screen stuff.

The SCREEN stuff is basically stuck on an ON TIMER type event where it takes place every 1/60th of a second.  (For 60 FPS display usually.)

Here's the basic program flow without a delay:

_RESIZE OFF     <-- this sets the variable to turn resize off

SCREEN _newsize   <--- this sets a flag so that on the next update of the screen thread, we swap to a new screen.   This can be anywhere from 0.00000 seconds to 1/60 seconds, as that timer event runs through its process

_RESIZE ON, _STRETCH   <--- this sets the variable to turn resizing back on, with it attempting to maintain the same aspect ratio you currently have.




See the issue with just the explaination above??

That SCREEN statement *MAY* not trigger automatically.  It's really just setting a flag so that the NEXT time the screen updates, it resizes to the screen you called.

That _RESIZE ON statement *HOWEVER* instantly sets the flag to turn resizing back on.  In most cases, this is going to be 0.0000000001 seconds (or some insane nano-count of time such as that) after that SCREEN statement sets its flag.

You're basically:
Turn OFF resizing
Set Flag for new screen
Turn On resizing
Let flag process 1/60 second later and ....   BLOW UP as you really don't want it to resize yet!



Add that delay in there and you solve that issue.

Turn OFF resizing
Set Flag for new screen.
whistle for a short moment and do nothing so that the screen actually resizes to the size we want
Turn on resizing

^^  That's the process you want to happen.   The actual code to accomplish this is even simpler than what I had before:

_RESIZE OFF   'no delay is needed here, as that variable changes instantly
SCREEN _newsize  'set the flag to change to the screen that you want  here
_DELAY 0.25 '0.25 is probably longer than actually required, but when dealing with any sort of race condition, I'd rather err on the side of caution
_RESIZE ON, _STRETCH




Does that all make sense over what we're seeing here and why it was acting the way it was for you previously?
Reply


Messages In This Thread
Problem with _Resize - by dano - 10-20-2024, 01:15 PM
RE: Problem with _Resize - by dano - 10-21-2024, 02:45 PM
RE: Problem with _Resize - by SMcNeill - 10-22-2024, 01:29 AM
RE: Problem with _Resize - by SMcNeill - 10-22-2024, 02:14 AM
RE: Problem with _Resize - by dano - 10-22-2024, 03:08 PM
RE: Problem with _Resize - by SMcNeill - 10-22-2024, 03:33 PM
RE: Problem with _Resize - by dano - 10-22-2024, 05:29 PM
RE: Problem with _Resize - by dano - 10-22-2024, 07:22 PM



Users browsing this thread: 1 Guest(s)