Bullet-proof way to check if a Screen is open?
Bullet-proof way to check if a Screen is open?
Anybody know a bullet-proof way to determine if a Screen is open? The Help file says that if I call ScreenDepth(), it "Returns the current screen depth, or zero if no screen is opened." But if I call ScreenDepth() when a screen is not open, I get a fatal error.
Re: Bullet-proof way to check if a Screen is open?
...with the debugger enabled. I know it's a little strange for a command to return 0 in release mode if it fails and yet you can't practically rely on that because you can't debug your program with that code.Alex777 wrote: I get a fatal error.
But you can temporarily disable the debugger around it, so there is a way to do what you want.
Code: Select all
InitSprite()
DisableDebugger
i = ScreenDepth()
EnableDebugger
Debug i
"Have you tried turning it off and on again ?"
A little PureBasic review
A little PureBasic review
Re: Bullet-proof way to check if a Screen is open?
Thanks, Luis! You are right - it's not difficult to track it myself, which is what I will do.