Library for screen splitting and printing text into parts for Colour Maximite 2 computer. Included is also file SplitScreenTest.BAS, where can be seen simple use of this library.
CONTROL STRING DESCRIPTION (cs$, 22 bytes)
dx% = STR2BIN(UINT16, LEFT$(cs$, 2)) x-coordinate of Left upper corner of the screen part
dy% = STR2BIN(UINT16, MID$(cs$, 3, 2)) y-coordinate of Left upper corner of the screen part
w% = STR2BIN(UINT16, MID$(cs$, 5, 2)) width of the screen part
h% = STR2BIN(UINT16, MID$(cs$, 7, 2)) height of the screen part
x% = STR2BIN(UINT16, MID$(cs$, 9, 2)) x-coordinate of the cursor (left upper)
y% = STR2BIN(UINT16, MID$(cs$, 11, 2)) y-coordinate of the cursor (left upper)
t% = STR2BIN(UINT8, MID$(cs$, 13, 1)) TAB width in pixels
f% = STR2BIN(UINT8, MID$(cs$, 14, 1)) FONT
fc% = STR2BIN(UINT32, MID$(cs$, 15, 4)) foreground color
bc% = STR2BIN(UINT32, MID$(cs$, 19, 4)) background color
SUB init.SPLIT(cs$, dx%, dy%, w%, h%)
creates new screen part X/Y/WIDTH/HEIGHT and sets control string cs$
SUB setStyle.SPLIT(cs$, t%, f%, fc%, bc%)
sets TAB, FONT, FOREGROUND and BACKGROUND
for not changing default, set the value to -1
SUB cls.SPLIT(cs$)
clears the screen, sets X/Y to 0
SUB print.SPLIT(cs$, txt$)
main FUNCTION for string output, parameteres are control string and txt$ to output
CHR$(8) is TAB character, used to go to the next TAB position
CHR$(10) is line feed character, uset to go to begin of the next line (screen can be scrolled up)
other ASCII codes bellow CHR$(32) are ignored
FUNCTION loadImage.SPLIT(cs$, fn$, iw%, ih%)
*load image into full part of the screen
*when we know image width/height (iw%/ih%) is used (need to be smaller than MM.XRES/MM.YRES)
*returns TRUE (=1) when OK
FUNCTION input.SPLIT(cs$, allowedChars$, maxLen%) AS STRING
*allows to input string in any split area, use any charaters from allowedChar$ (or any, if this string is empty)
*you can delete last character with BACKSPACE, finish the input with ENTER or RETURN (this will be not part of the returned string)
*with maxLen% you can limit length of the input, if it's <=0 or >255 then the limit will be 255 characters
first version
added input.SPLIT function
bugfix in scrolling (proper set height and limit)
TAB corrected from CHR$(8) to CHR$(9)