2 changes here:
line 13062: When opening a file for random access, if the LEN is not supplied, it defaults the length correctly, but does not allocate the buffer correctly. The code should reference the record_length in the file struct.
Changes in lines 15798-15853: When printing text to the screen, carriage returns in the text are ignored. In sub_file_print, the code for printing to the screen is modified to honor carriage returns.
Fixes a bug that would make QB64 return the incorrect size monitor/desktop size when the resolution is scaled. Also, the last fix I added that set `_Source` to `_Console` automatically caused an issue with `_Width` and `_Height`, causing them to return only the console's image dimensions rather than the image that is passed.
Done for the sake of retrocompatibility. Although those symbols are simply ignored, as the type is determined by the variable types given at the respective READ statements.
Before we strip off the requirements (like "monospace" and such), we should first see if the font exists on the drive, since we call the routine recursively looking for it.
- Changes CFont to sub__consolefont and func_CInp to func_cinp, in alignment with the rest of libqb/qbx.
- Adds stubs to all new console functionality, so we can still ship for other OSes with no bigger issues.
- Adds new keywords to syntax highlighter.
Aditonal to VAL, the &B prefixed numbers are now also recognized by INPUT (keyboard and file input) and also by READ, if those numbers are noted in DATA statements.
CFont uses a few function calls which aren't supported by anything older than Windows Vista, while QB64 otherwise works all the way back to Windows XP. Since there's no desire to make us lose functionality with older systems and obsolute them to oblivion, the code has been commented out and replaced with a stub as default. Users of older machines can simply use it "as is", as can folks who don't care about console functionality. Users with versions of Windows from Vista up, can simply uncomment the code (comment out the placeholder stub), and then purge libqb so we automatically rebuild our library to make use of the routine.
It seemed the easiest way to keep it in there, more or less, so that people who wanted to use it can, while not bothering the rest of the user base. There just needs to be a short note wrote up in the documention on how to "enable the command", but it's not a hard process (uncomment a few lines, comment a few others, and run a batch file -- if a programmer can't handle that much, then they don't need the command to start with...).
Window's CONSOLE support has been extended so that:
CSRLIN support added.
POS(0) support added.
LOCATE support added. (Works with optional parameters.)
COLOR support added.
SCREEN support added to get both character and color information of any point on the console.
tab() glitch fixed. (Which could cause an endless loop when printing with comma spaced text/numbers.)
_WIDTH support added.
_HEIGHT support added.
WIDTH support added, with 2 new parameters added so we can set the buffer width and buffer height also.
CLS support semi-added. (Doesn't accept colored backgrounds; it clears the screen black. I'm getting tired of working up console stuff which I probably won't ever use myself...)
SLEEP support added.
END support added so we now end with any keypress and not just enter.
_CONSOLEINPUT added, so we can tell the difference in mouse and keyboard input.
_CINP(toggle) support added, which allows us to get single character keystrokes from the console.
_CONSOLEFONT FontName, FontSize support added, which allows us to change the font and font size we use for the console.
_CONSOLECURSOR _SHOW|_HIDE, cursorsize support added, which allows us to show or hide the cursor in the console, and to change its size (from 0 to 100), as desired.
New keyboard commands added:
_CAPSLOCK -- returns 1 if caps lock is on, 0 if it isn't.
_NUMLOCK -- as above, but for num lock
_SCROLLOCK -- as above, but for scroll lock
_TOGGLE_CAPSLOCK -- toggles the caps lock state for us.
_TOGGLE_NUMLOCK -- same, but for num lock
_TOGGLE_SCROLLOCK -- same, but for scroll lock
Two new keywords added:
FUNCTION _INFLATE$ (text$)
FUNCTION _DEFLATE$ (text$)
Use of these commands can compress and decompress strings using the ZLIB library.
- Windows: cursor returns to top-left of console screen buffer
- Non-Windows: isatty(stdout) check to prevent CLS from working when
stdout is redirected
_lrotl is defined elsewhere in the graphics routines. By using a custom
QB64 version, it tosses definition errors with newer compiler versions.
Easiest fix: Remove the custom _lrotl since it's only used a total of 3
times (all in the LINE routine), and do themath without the function
naturally.
Requesting state for an invalid GLUT state name returns negative one...
So, we start with a -1 and wait until GLUT has initialized our window
and registered it with the OS all properly, and then use the proper
return value to move the window to the middle of the screen.
change so that the windowhandle will return a 64-bit value for QB64x64
versions, while returning a 32-bit value for QB64. This allows for
upgrade to 64-bit to be as simple as just swapping compilers and then
rebuilding QB64 with the setup script.
- Allows using _DROPPEDFILE as an array ranging from 1 TO _TOTALDROPPEDFILES.
- Using _DROPPEDFILE as an array doesn't reset _TOTALDROPPEDFILES (unlike when reading _DROPPEDFILE$ sequentially with no parameter), so it's necessary to call _FINISHDROP after working with the list of dropped files so it'll be reset.
New statement:
_ACCEPTFILEDROP [{ON|OFF}]
Enables a program to accept files being dropped from a folder.
New functions:
_TOTALDROPPEDFILES
Returns the number of files that have been received via drag/drop.
_DROPPEDFILE$
Returns the list of files that have been dropped. The function sequentially returns the file list and decreases _TOTALDROPPEDFILES with every read.
The statement works as INSTR does but starts from the end of the passed string (or from the specified position) and looks for the passed substring while moving backards.
Takes after VBScript's InStrRev: https://www.w3schools.com/asp/func_instrrev.aspCloses#51
Syntax:
_ALLOWFULLSCREEN [{_STRETCH|_SQUAREPIXELS|_OFF|_ALL}][,{_SMOOTH|_OFF|_ALL}]
Existing _FULLSCREEN statement is not bound by _ALLOWFULLSCREEN's settings, only the ALT+ENTER key combo.
_ECHO is more of a macro than a new statement, as it'll perform the following actions:
1- Save current _DEST;
2- Switch to _CONSOLE;
3- Print the passed string (only strings accepted);
4- Switch back to previous _DEST.
None of the PRINT features such as USING, numeric variables, retaining the cursor are implemented/planned for this statement.
Closes#29