RECURSION
you change PlayerWindHeight
then check if it is greater than Screen Height
if it is you change it again (which call resize, which in turn changes it to Width*.6 again
[quote=427681:@Jay Madren]Yes, it’s an endless loop. But that should just make the app unresponsive, not make it crash.
[/quote]
and endless loop and a recursive loop are not the same
and endless loop stays inside the same scope and doesn’t consume stack space.
a recursive loop does, and as soon as all the stack space is consume the app will crash.
while true<>false
... this is an endless loop
wend
function test()
test() // this is a recursive loop
end function
[quote=427683:@Dave S]a recursive loop does, and as soon as all the stack space is consume the app will crash.[/quote]I was thinking that since the code does not call the Resized event directly, and (I thought) the new event wouldn’t be fired until the current event exited, that it wouldn’t create a recursion. But I just tested it and it does. So you’re correct, this is a recursive loop that will crash the app.
But my suggestion will avoid that.
Also, Martin, if you are wanting to enforce a certain aspect ratio, then you’ll need to add more logic to what I wrote to maintain that ratio while keeping the window from expanding beyond the screen. But you will still need to it in a way that doesn’t cause the recursion.