02-14-2024, 05:41 PM
_DESKTOPWIDTH is one of those GLUT library calls on Mac, and as such it's all wrapped up in the whole display queue lineup. (Screen has to be initialized, draw, set, reported to the OS, and then polled to return the value.)
I definitely wouldn't want to rely on calling it inside a loop of any sort, or else that loop is going to take a rather large performace hit, as you've noticed for yourself.
My recommendation? At the start of a program:
DIM SHARED DTW AS LONG: DTW = _DESKTOPWIDTH
Unless you expect the user of resizing their desktop on you while the program is running, I'd ust get that information once, store it, and then go with that stored value throughout my program for Linux and Mac.
I definitely wouldn't want to rely on calling it inside a loop of any sort, or else that loop is going to take a rather large performace hit, as you've noticed for yourself.
My recommendation? At the start of a program:
DIM SHARED DTW AS LONG: DTW = _DESKTOPWIDTH
Unless you expect the user of resizing their desktop on you while the program is running, I'd ust get that information once, store it, and then go with that stored value throughout my program for Linux and Mac.