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.
If a user has Homebrew installed, calling g++ won't use Apple's Xcode version of the tool, which is required by QB64. This fix continues on with the patch introduced in 4dbdddc89e.
Extra "osx" references replaced with "macOS", but nothing substantial (almost aesthetic).
Fixed an issue where Apple's Clang is forcefully used instead of GCC for compiling QB64 applications. (Fixes issues for those using true GCC via Homebrew and not Clang that just has a symlink of GCC).
- 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
Existing syntax:
colour~& = _RGB32(red, green, blue)
New possible uses:
- Instead of passing identical rgb values to achieve a shade of gray, pass only 1 parameter for all color components:
colour~& = _RGB32(51) 'same as _RGB32(51, 51, 51)
- _RGB32 can now take an optional alpha parameter, which makes _RGBA32 obsolete (although it still exists for retrocompatibility):
colour~& = _RGB32(255, 0, 255, 30) 'same as _RGBA32(255, 0, 255, 30)
- If you want a shade of gray and also to specify the alpha level, you can pass just two parameters:
colour~& = _RGB32(51, 30) 'same as _RGBA32(51, 51, 51, 30)
In summary:
- 1 parameter = red, green and blue simultaneously set.
- 2 parameters = red, green and blue simultaneously set plus alpha level.
- 3 parameters = red, green and blue as usual.
- 4 parameters = red, green and blue plus alpha level (same as _RGBA32).
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
- _WINDOWHANDLE exposes the current window's handle (Windows-only).
- _WINDOWHASFOCUS returns true (-1) when the program is the foremost window (Windows-only). Always returns -1 in other OSes.
- _TITLE$ (function) returns the last title set using the _TITLE statement.
Change so that modifer keypresses will only register when the window has
focus in Windows. This corrects the issue with SLEEP, KEYHIT, and
INP(&H60) registering SHIFT, CTRL, and ALT keypresses even when the
program is not in focus or is running as a background app.
Also changed _SCREENEXISTS (and a few other window user commands) so
that they require windows to have actually registered a windows handle
for the function to return -1, and not just for glut to have finished
initializing the screen itself.
- When mode = 256, _LOADIMAGE will return an 8bit image with the loaded file's colors matching the default palette.
- Slower for bigger images, because of the call to matchcol();
- Fetch an image from the clipboard with handle& = _CLIPBOARDIMAGE
- If there isn't an image in the clipboard, handle& will be -1.
- Copy a valid image to the clipboard (All screen modes, except 0) with _CLIPBOARDIMAGE = handle&