AppTerminate and AppTerminate()
BlitzMax Forums/BlitzMax Programming/AppTerminate and AppTerminate()
| ||
I was trying to get a non-maxgui window to be closed when clicking on the "x"....Strict Graphics 800 , 600 , 0 Global x% = 0 Repeat gameloop() Until KeyHit(KEY_ESCAPE) Or AppTerminate Function gameloop() x = (X + 1) Mod 600 Cls DrawText ( "O",x,100 ) Flip End Function The above code would run and then stop immediately, because I had typed AppTerminate not AppTerminate() Which leads me to he question what is AppTerminate when not expressed as a function? |
| ||
Either a function pointer, which will contain an address of the AppTerminate function, which will be non-zero, so will cause the loop to exit, or maybe AppTerminate by itself actually forces the app to terminate (I would think the first idea more likely). |
| ||
Strict Graphics 800 , 600 , 0 Global x% = 0 Global term() = AppTerminate Repeat gameloop() Until KeyHit(KEY_ESCAPE) Or term() Function gameloop() x = (X + 1) Mod 600 Cls DrawText ( "O",x,100 ) Flip End Function it's a function pointer. |