04-08-2023, 10:49 PM
(04-08-2023, 09:55 PM)mnrvovrfc Wrote: LOCATE was designed originally to position the cursor in text mode SCREEN 0, to set up PRINT. However, people expected the same exact behavior eg. in SCREEN 12, so it was left to its fate.
_PRINTSTRING is a different creature which requires screen pixel coordinates to work, treating the text also given to it as a graphics figure such as line or circle. That's why you have to compute stuff with other functions to be able to center the text, without caring if it's a monospaced font.
LOCATE can be used with PRINT only with monospaced fonts as Steve had said. It limits its use because it doesn't work as well with variable-spaced fonts. In that case _PRINTSTRING is available although it requires more "skill" to use it.
LOCATE was designed to work in SCREEN 12 exactly as it had in SCREEN 0 because it used the EXACT same fonts. QB45 doesn't have a _LOADFONT command and it doesn't allow you to load variable-width fonts. Same command for SCREEN 12 as for SCREEN 0, if you wanted to print and position text onto the screen.
_PRINTSCREEN isn't all that different. The only real difference with it is that it takes graphic coordinates instead of text coordinates, and it doesn't change the print cursor location.
LOCATE works just fine with variable-width fonts. When did Steve say it didn't? I just mentioned that the second parameter works with a pixel value rather than a column value -- as variable width columns aren't set at the same position on each line of text.
LOCATE down, right --- in ALL screen modes and with ALL fonts, that statement works without any issues. down is always going to be the number of rows down where the text is located. right, when used with variable width fonts, is going to be the number of pixels right to offset the text. With monospace fonts, it's going to be the number of characters right to offset the text.
That's the only difference in the behavior with LOCATE.
When used with variable-width fonts, the second parameter for LOCATE relates to pixels instead of characters. <-- It really is that simple.