06-15-2024, 03:31 AM
And for those curious, here's my initial attempt to determine just how much delay would be necessary for _RESIZE to report properly after a SCREEN statment is issued:
Note that these times are hardly consistent as you're dealing with the relationship between multiple threads and how they interact, but the longest delay I've seen on my laptop is about 0.18 seconds. For safety's sake, if I needed to report this without worry for any race condition, I'd probably just toss a _DELAY 0.3 in my program after some SCREEN statement, to make certain that flag and all had time to process before letting the program continue on. (Or else I'd do like the above, if I was certain _RESIZE was 0 before I issued that SCREEN command.)
Code: (Select All)
$RESIZE:ON
t# = TIMER(0.001)
FOR i = 1 TO 10
DO: LOOP UNTIL _RESIZE
t1# = TIMER(0.001)
SCREEN _NEWIMAGE(640, 480, 32)
DO: LOOP UNTIL _RESIZE
t2# = TIMER(0.001)
SCREEN _NEWIMAGE(800, 600, 32)
DO: LOOP UNTIL _RESIZE
t3# = TIMER(0.001)
PRINT "Pass "; i; " of 10"
PRINT USING "##.#### seconds for the first resize to register."; t1# - t#
PRINT USING "##.#### seconds for the second resize to register."; t2# - t1#
PRINT USING "##.#### seconds for the second resize to register."; t3# - t2#
SLEEP
t# = TIMER(0.001)
SCREEN _NEWIMAGE(1024, 720, 32)
NEXT
SYSTEM
Note that these times are hardly consistent as you're dealing with the relationship between multiple threads and how they interact, but the longest delay I've seen on my laptop is about 0.18 seconds. For safety's sake, if I needed to report this without worry for any race condition, I'd probably just toss a _DELAY 0.3 in my program after some SCREEN statement, to make certain that flag and all had time to process before letting the program continue on. (Or else I'd do like the above, if I was certain _RESIZE was 0 before I issued that SCREEN command.)