Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
If you're like me, over time you've written and accumulated a zillion different little routines full of subs and functions to help do things for you. If you're also like me, when you need to be able to find those routines to make use of them again, they end up hiding from you.
I've decided it's about time that I did something about that and get my junk a little better organized -- and while I'm at it, I thought I'd share and see if anyone else wanted to jump in on the bandwagon and share their own tools in the same place so we could have a "one stop shop" for all things related to expanding QB64PE functionality.
To that end, I present: https://github.com/SteveMcNeill/QB64-Pho...on-Toolbox
At this point in time, it's very much a work-in-progress, with just ONE whole commit in its entire Github history! WOOT!! But, I hope from this one commit, you can see the general concept of what I'm shooting to accomplish here:
1) Create a simple library which can be included into any QB64 program with only one set of *.BI and *.BM include files.
2) This library has to have the functionality to allow us to ONLY load and use the subs/functions that we want with our programs. (Precompiler $IF commands allow us to do this.)
3) This library has to be Option _Explicit compatible.
4) Over time, this library will need to have documentation added for each of the routines inside it, explaining how to use those routines and what is expected from each parameter.
5) Examples and Samples of each routine will need to be created and added to the library in time, so users can simply load those files and see the routines in action.
At the moment, I've only got a handful of commands pushed into this initial commit, and I can already see that I'm going to have to do some learning in the future to make things more as I envision. (One thing I've got to work on is learning and expanding my knowledge of markup so the *.md files I'll be creating look a little nicer and more useful.)
As it is, it's the very barest of bones for a toolbox, but it's a start. Feel free to follow, or speak up to be added as a contributor. Over time, I'm hoping that this can expand and become a single go to source for all things to expand QB64PE for us.
Posts: 652
Threads: 96
Joined: Apr 2022
Reputation:
22
(10-13-2023, 01:45 AM)SMcNeill Wrote: If you're like me, over time you've written and accumulated a zillion different little routines full of subs and functions to help do things for you. If you're also like me, when you need to be able to find those routines to make use of them again, they end up hiding from you.
I've decided it's about time that I did something about that and get my junk a little better organized -- and while I'm at it, I thought I'd share and see if anyone else wanted to jump in on the bandwagon and share their own tools in the same place so we could have a "one stop shop" for all things related to expanding QB64PE functionality.
To that end, I present: https://github.com/SteveMcNeill/QB64-Pho...on-Toolbox
At this point in time, it's very much a work-in-progress, with just ONE whole commit in its entire Github history! WOOT!! But, I hope from this one commit, you can see the general concept of what I'm shooting to accomplish here:
1) Create a simple library which can be included into any QB64 program with only one set of *.BI and *.BM include files.
2) This library has to have the functionality to allow us to ONLY load and use the subs/functions that we want with our programs. (Precompiler $IF commands allow us to do this.)
3) This library has to be Option _Explicit compatible.
4) Over time, this library will need to have documentation added for each of the routines inside it, explaining how to use those routines and what is expected from each parameter.
5) Examples and Samples of each routine will need to be created and added to the library in time, so users can simply load those files and see the routines in action.
At the moment, I've only got a handful of commands pushed into this initial commit, and I can already see that I'm going to have to do some learning in the future to make things more as I envision. (One thing I've got to work on is learning and expanding my knowledge of markup so the *.md files I'll be creating look a little nicer and more useful.)
As it is, it's the very barest of bones for a toolbox, but it's a start. Feel free to follow, or speak up to be added as a contributor. Over time, I'm hoping that this can expand and become a single go to source for all things to expand QB64PE for us.
Sounds great @Steve (although I know I'll be more of a User than a Donor).
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
One day in and 20 of my most useful subs/functions and 2 declare libraries added to the toolbox:
Code: (Select All) List of $LET tags to enable and add various routines to your code:
#### INCLUDE_ALL: Enables all subs and functions inside the toolbox.
#### INCLUDE_IMAGE: Enables all subs and functions related to IMAGE commands and functionality.
INCLUDE_CIRCLEFILL
INCLUDE_ELLIPSEFILL
INCLUDE_ELLIPSETILT
INCLUDE_ELLIPSETILTFILL
INCLUDE_QUADFILL
INCLUDE_TRIANGLEFILL
#### INCLUDE_MEM: Enables all subs and functions related to MEM commands and functionality.
INCLUDE_CONVERT_OFFSET
INCLUDE_MEMSORT
#### INCLUDE_MOUSE: Enables all subs and functions related to MOUSE commands and functionality.
INCLUDE_MOUSEBUTTONSTATUS
#### INCLUDE_SCREEN: Enables all subs and functions related to SCREEN commands and functionality.
INCLUDE_BORDERWIDTH
INCLUDE_SCREENMOVE
INCLUDE_SCREENMOVE_MIDDLE
INCLUDE_SCROLLUP
INCLUDE_SCROLLDOWN
INCLUDE_TITLEBARHEIGHT
##### INCLUDE_SOUND: Enables all subs and functions related to SOUND commands and functionality.
INCLUDE_SPEAK
#### INCLUDE_TIME: Enables all subs and functions related to TIME and DATE commands and functionality.
INCLUDE_EXTENDEDTIMER
INCLUDE_GETDAY
INCLUDE_UNIDATE
INCLUDE_TIMESTAMP
#### INDEPENDENT INCLUDES:
INCLUDE_BORDERWIDTH: Enables the Function BorderWidth which is used to return the width of the programs borders to us.
INCLUDE_CIRCLEFILL: Enables the Sub CircleFill which generates a circle filled in the specified color.
INCLUDE_CONVERT_OFFSET: Enables the Function ConvertOffset which is used to convert offsets to either LONG or INTEGER64 values as appropiate.
INCLUDE_ELLIPSEFILL: Enables the Sub EllipseFill which generates an ellipse filled in the specified color.
INCLUDE_ELLIPSETILT: Enables the Sub EllipseTilt which generates an ellipse tiled by the specified angle.
INCLUDE_ELLIPSETILTFILL: Enables the Sub EllipseTileFill which generates an ellipse tiled by the specified angle, and filled in the specified color.
INCLUDE_EXTENDEDTIMER: Enables the Function ExtendedTimer which is used to get system time without worrying over midnight issues.
INCLUDE_GETDAY: Enables the Function GetDay$ which is used to return the Day from any given MM/DD/YYYY date.
INCLUDE_UNIDATE: Enables the Function UniDate which transforms a given DATE$ to whatever Universal Date format is desired.
INCLUDE_MEMSORT: Enables the Function MemSort which is used to quickly sort arrays via the _MEM commands.
INCLUDE_MOUSEBUTTONSTATUS: Enables the Function MouseButtonStatus which returns enhanced values for mouse buttons and scroll wheels for programs.
INCLUDE_SCREENMOVE: Enables the Sub ScreenMove which allows the user to place the proram screen at absolute coordinates X, Y, without concern for border or titlebar adjustment.
INCLUDE_SCREENMOVE_MIDDLE: Enables the Sub ScreenMove Middle which places the program screen in the middle of the desktop, without concern for border or titlebar adjustment.
INCLUDE_SCROLLDOWN: Enables the Sub ScrollDown which is used to scroll the screen down one line of characters.
INCLUDE_SCROLLUP: Enables the Sub ScrollUp which is used to scroll the screen up one line of characters.
INCLUDE_SPEAK: Windows-Only command which uses Powershell via Sub Speak to turn text into speech.
INCLUDE_TIMESTAMP: Enables the Function TimeStamp which returns an Unix-style timestamp.
INCLUDE_TITLEBARHEIGHT: Enables the Function TitleBarHeight which is used to return the size of the program's titlebar, in pixels.
Posts: 476
Threads: 25
Joined: Nov 2022
Reputation:
45
This is a nice library so far @smcneill. Thanks for sharing
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
Progress report for those interested:
QB64PE Subs and Functions:
Code: (Select All) List of $LET tags to enable and add various routines to your code:
#### INCLUDE_ALL: Enables all subs and functions inside the toolbox.
#### INCLUDE_FILE: Enables all subs and functions related to FILE commands and functionality.
INCLUDE_GETFILELIST
#### INCLUDE_IMAGE: Enables all subs and functions related to IMAGE commands and functionality.
INCLUDE_CIRCLEFILL
INCLUDE_DISPLAYIMAGE
INCLUDE_ELLIPSEFILL
INCLUDE_ELLIPSETILT
INCLUDE_ELLIPSETILTFILL
INCLUDE_QUADFILL
INCLUDE_ROUNDRECT
INCLUDE_ROUNDRECTFILL
INCLUDE_TEXTTOIMAGE
INCLUDE_THICKCIRCLE
INCLUDE_TRIANGLEFILL
#### INCLUDE_MEM: Enables all subs and functions related to MEM commands and functionality.
INCLUDE_CONVERT_OFFSET
INCLUDE_MEMSORT
#### INCLUDE_MOUSE: Enables all subs and functions related to MOUSE commands and functionality.
INCLUDE_MOUSEBUTTONSTATUS
#### INCLUDE_SCREEN: Enables all subs and functions related to SCREEN commands and functionality.
INCLUDE_BORDERWIDTH
INCLUDE_SCREENMOVE
INCLUDE_SCREENMOVE_MIDDLE
INCLUDE_SCROLLDOWN
INCLUDE_SCROLLUP
INCLUDE_TITLEBARHEIGHT
##### INCLUDE_SOUND: Enables all subs and functions related to SOUND commands and functionality.
INCLUDE_SPEAK
#### INCLUDE_TIME: Enables all subs and functions related to TIME and DATE commands and functionality.
INCLUDE_CHECKDAYFORMAT
INCLUDE_EXTENDEDTIMER
INCLUDE_GETDAY
INCLUDE_GETMONTH
INCLUDE_GETWEEKDAY
INCLUDE_GETWEEKDAYNAME
INCLUDE_GETYEAR
INCLUDE_MAKEDATE
INCLUDE_TIMESTAMP
INCLUDE_UNIDATE
#### INDEPENDENT INCLUDES:
INCLUDE_BORDERWIDTH: Enables the Function BorderWidth which is used to return the width of the programs borders to us.
INCLUDE_CHECKDAYFORMAT: Enables the Function MakeDate which takes a string and determines if it's in a proper MM-DD-YYYY format.
INCLUDE_CIRCLEFILL: Enables the Sub CircleFill which generates a circle filled in the specified color.
INCLUDE_CONVERT_OFFSET: Enables the Function ConvertOffset which is used to convert offsets to either LONG or INTEGER64 values as appropiate.
INCLUDE_DISPLAYIMAGE: Enables the Sub DisplayImage which displays an image at x/y coordinates, scales it, and rotates it as desired.
INCLUDE_ELLIPSEFILL: Enables the Sub EllipseFill which generates an ellipse filled in the specified color.
INCLUDE_ELLIPSETILT: Enables the Sub EllipseTilt which generates an ellipse tiled by the specified angle.
INCLUDE_ELLIPSETILTFILL: Enables the Sub EllipseTileFill which generates an ellipse tiled by the specified angle, and filled in the specified color.
INCLUDE_EXTENDEDTIMER: Enables the Function ExtendedTimer which is used to get system time without worrying over midnight issues.
INCLUDE_GETDAY: Enables the Function GetDay which is used to return the Day from any given MM/DD/YYYY date.
INCLUDE_GETMONTH: Enables the Function GetMonth which is used to return the Month from any given MM/DD/YYYY date.
INCLUDE_GETWEEKDAY: Enables the Function GetWeekDay which is used to return the Position of the Day of Week from any given MM/DD/YYYY date.
INCLUDE_GETWEEKDAYNAME: Enables the Function GetWeekDayName which is used to return the Name of the Day of Week from any given MM/DD/YYYY date.
INCLUDE_GETFILELIST: Enables the Function GetFileList (Path$) which returns a listing of all files and directories to a set string array called FileList().
INCLUDE_GETYEAR: Enables the Function GetYear which is used to return the Year from any given MM/DD/YYYY date.
INCLUDE_MAKEDATE: Enables the Function MakeDate which takes MM, DD, YYYY values and formats them to create a proper date.
INCLUDE_MEMSORT: Enables the Function MemSort which is used to quickly sort arrays via the _MEM commands.
INCLUDE_MOUSEBUTTONSTATUS: Enables the Function MouseButtonStatus which returns enhanced values for mouse buttons and scroll wheels for programs.
INCLUDE_ROUNDRECT: Enables the Sub RoundRect which generates a rounded rectangle.
INCLUDE_ROUNDRECTFILL: Enables the Sub RoundRectFill which generates a rounded rectangle filled in the specified color.
INCLUDE_SCREENMOVE: Enables the Sub ScreenMove which allows the user to place the proram screen at absolute coordinates X, Y, without concern for border or titlebar adjustment.
INCLUDE_SCREENMOVE_MIDDLE: Enables the Sub ScreenMove Middle which places the program screen in the middle of the desktop, without concern for border or titlebar adjustment.
INCLUDE_SCROLLDOWN: Enables the Sub ScrollDown which is used to scroll the screen down one line of characters.
INCLUDE_SCROLLUP: Enables the Sub ScrollUp which is used to scroll the screen up one line of characters.
INCLUDE_SPEAK: Windows-Only command which uses Powershell via Sub Speak to turn text into speech.
INCLUDE_TEXTTOIMAGE: Enables the Sub TextToImage which takes a given text string and converts it in an image which can be handled as any other image with _PUTIMAGE or DisplayImage.
INCLUDE_THICKCIRCLE: Enables the Sub ThickCircle which generates a circle with a multi-pixel border in the specified color.
INCLUDE_TIMESTAMP: Enables the Function TimeStamp which returns an Unix-style timestamp.
INCLUDE_TITLEBARHEIGHT: Enables the Function TitleBarHeight which is used to return the size of the program's titlebar, in pixels.
INCLUDE_UNIDATE: Enables the Function UniDate which transforms a given DATE$ to whatever Universal Date format is desired.
Declare Library Subs and Functions:
Code: (Select All) A list of the DECLARE LIBRARY routines which are included, which an user might want to make use of separately for whatever reason:
#### INCLUDE_ALL: Includes all DECLARE LIBRARY subs and functions.
#### INCLUDE_FILE: Includes all DECLARE LIBRARY subs and functions.
Note: direntry.h is ued for the Function GetFileList, but it has no subs or functions which an user would normally find necessary to call or interact with.
#### INCLUDE_GLUT: Includes all DECLARE LIBRARY routines that come from glut.
INCLUDE_GLUTGET
INCLUDE_GLUTRESHAPEWINDOW
#### INCLUDE_MATH: Include all DECLARE LIBRARY routines related to math functions or subs.
INCLUDE_ISINF
INCLUDE_ISNAN
#### INCLUDE_MEM: Include all DECLARE LIBRARY routines related to mem functions or subs.
INCLUDE_SETMEMORYBYTE
INCLUDE_SETMEMORYINTEGER
INCLUDE_SETMEMORYLONG
#### INDEPENDENT DECLARE LIBRARY subs and functions.
INCLUDE_GLUTGET: Adds Function glutget& (ByVal what&)
INCLUDE_GLUTRESHAPEWINDOW: Adds SUB glutReshapeWindow (BYVAL width&, BYVAL height&)
INCLUDE_ISINF: Adds FUNCTION IsInf% (BYVAL n AS _FLOAT)
INCLUDE_ISNAN: Adds FUNCTION IsNan% (BYVAL n AS _FLOAT)
INCLUDE_SETMEMORYBYTE: Adds SUB SetMemoryByte (BYVAL dst AS _UNSIGNED _OFFSET, BYVAL elements AS _UNSIGNED LONG, BYVAL value AS _UNSIGNED _BYTE)
INCLUDE_SETMEMORYINTEGER: Adds SUB SetMemoryInteger (BYVAL dst AS _UNSIGNED _OFFSET, BYVAL elements AS _UNSIGNED LONG, BYVAL value AS _UNSIGNED INTEGER)
INCLUDE_SETMEMORYLONG: Adds SUB SetMemoryLong (BYVAL dst AS _UNSIGNED _OFFSET, BYVAL elements AS _UNSIGNED LONG, BYVAL value AS _UNSIGNED LONG)
That's a total of 30 QB64PE Subs and Functions at the moment, and 8 Declare Library Subs and Functions which are exposed and available for us to add to our programs.
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
Added Text-To-Speech (Windows Only) into the Toolbox, along with a sample illustrating it.
Posts: 346
Threads: 24
Joined: Jul 2022
Reputation:
20
I love it, starting from the idea of a flexible onebox library .
Yes, predirectives of compiler are good!
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
Just added a folder full of various monospaced fonts which all load and look good in QB64PE, and which have the full range of 256 ASCII characters available for use. (And unifont -- even though I personally don't care for its appearance the most -- is one of those truly rare beasts: monospaced UNICODE fonts, with close to 65000 different characters inside the font set. If it can't display the characters you want, then you don't really want those characters! )
Posts: 1,586
Threads: 59
Joined: Jul 2022
Reputation:
52
How fun it is to have a single Unicode character be a variable name in the Julia REPL! Should have the "JuliaMono" going on then.
There are also the "Nerd" fonts, but some of these suck with vertical space and lying a bit about point size ("Terminess" I'm looking at you).
https://www.nerdfonts.com/font-downloads
This allows the user to see how the fonts look like. Although it just goes somewhere into this place:
https://github.com/ryanoasis/nerd-fonts
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
Now added the ability to embed a small selection of fonts directly into a QB64PE program, which means they wouldn't have to rely on any external files once compiled and ran, so you don't have to worry about the end user not having the proper files on their drive to run your program glitch-free.
Basic style example is below:
Code: (Select All)
$Let INCLUDE_ALL = TRUE
$Let EMBED_COURIER_NEW = TRUE
$Let EMBED_CONSOLA = TRUE
$Let EMBED_SOURCE_CODE_PRO = TRUE
'Note that we ALSO have to specify which fonts we want to embed in our program,
'as we do above with the EMBED_COURIER_NEW = TRUE statement.
'This is because fonts can become quite large in size, and no single program
'needs to become bloated by several hundred MB as it attempts to embed fonts in itself
'that it doesn't even make use of!
'$INCLUDE:'..\Library Files\Toolbox.BI'
Screen _NewImage(800, 600, 32)
f = ReturnFont("Courier New", 20, "") ' A simple little _LOADFONT replacement
_Font f: _PrintString (0, 0), "Hello World" ' except here, we specify the font's name (not FILE NAME)
_Font 16: _FreeFont f
f = ReturnFont("Courier New", 20, "Bold") ' and we can set the style which we want for the font.
_Font f: _PrintString (0, _FontHeight), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Courier New", 20, "Italic")
_Font f: _PrintString (0, _FontHeight * 2), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Courier New", 20, "Bold,Italic")
_Font f: _PrintString (0, _FontHeight * 3), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "")
_Font f: _PrintString (0, _FontHeight * 5), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "Bold")
_Font f: _PrintString (0, _FontHeight * 6), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "Italic")
_Font f: _PrintString (0, _FontHeight * 7), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Consola", 20, "Bold,Italic")
_Font f: _PrintString (0, _FontHeight * 8), "Hello World"
_Font 16: _FreeFont f
f = ReturnFont("Source Code Pro", 20, "Medium")
_Font f: _PrintString (0, _FontHeight * 10), "Hello World"
_Font 16: _FreeFont f
'$INCLUDE:'..\Library Files\Toolbox.BM'
|