08-14-2022, 04:00 PM (This post was last modified: 08-21-2022, 11:00 PM by SMcNeill.)
A collection of QB64 samples and a little program included with them to help showcase them for everyone. Download the archive and enjoy!
You'll find the pictured QB64-PE Sample Showcase.bas file inside the QB64 Samples folder, and you can compile it and run it from there. (Just make certain that the option is set for QB64-PE to export your EXE to the source folder, or else the paths won't work.)
Note that this is still a work in progress, and it does tend to still have several little glitches in it, but I thought I'd go ahead and showcase what it's going to be now, in case anyone wanted to add samples of their own work to the list.
What's required if you want to add your own samples in here is:
For the index:
Title
Author
Tags (try to use no more than 3 or so)
Link to where it's found on the web.
And a small description.
For the source:
Along with the source code and any resource files all gathered up into one neat little subfolder for sharing.
A screenshot (in png format)
Set those things up, in the basic format you find in the folders here, and I'll be happy to add other samples into this as I go along and work all the little kinks out of it.
Update to showcase the author's name as well. The screen is a little more cramped now, but I can't believe I forgot and left that off.
Work in progress; what can I say?
Code: (Select All)
'QB64-PE Sample Showcase
'code by SMcNeill (c) 2022
'code is under standard MIT License -- https://en.wikipedia.org/wiki/MIT_License
'inspired by code sample archive from QB64.com which is also MIT Licensed
Type Sample_Index_Type
title As String
author As String
tag As String
description As String
End Type
'format for data files is:
'Start line [START ENTRY]
'Title This is the same as the directory name
'Author(s)
'Tag(s)
'Description
'Continue Description as needed.
'Finish Line [END ENTRY]
'All sample information is kept in the above format and organized for ease of reference and editing in any text editor.
screenchanged = -1
Do
If screenchanged Then
DisplayScreen start, selected, limit
screenchanged = 0
End If
k = _KeyHit
Select Case k
Case 27: System
Case 18432
selected = selected - 1: If selected < 0 Then selected = 40
screenchanged = -1
Case 20480:
selected = selected + 1: If selected > limit Then selected = 0
screenchanged = -1
Case Asc("N"), Asc("n")
start = start + 40: If start > count Then start = 0
screenchanged = -1
Case Asc("P"), Asc("p"):
If start = 0 Then
start = count - 40
Else
start = start - 40: If start < 0 Then start = 0
End If
screenchanged = -1
End Select
_Limit 30
_Display
Loop
Sub DisplayScreen (start, selected, limit)
Static screenshot, blankscreen
If blankscreen = 0 Then blankscreen = _NewImage(460, 340, 32)
finish = start + 40: If finish > count Then finish = count
limit = finish - start
If selected < 0 Then selected = 0
If selected > limit Then selected = limit
Cls , SkyBlue
Color Black, transparent
Print " ###"; Tab(10); "Title"; Tab(40); "Author"; Tab(60); "Tags"; Tab(120); "Details"
For i = start To finish
If i = start + selected Then
Line (0, selected * 16 + 16)-Step(770, 16), Red, BF
If screenshot <> 0 And screenshot <> -1 Then _FreeImage screenshot
temp$ = "./" + SI(i).title + "/screenshot.png"
screenshot = _LoadImage(temp$, 32)
If screenshot <> -1 Then _PutImage (800, 20)-(1260, 359), screenshot
_Dest blankscreen
Cls , Black
Color White, Black
Print SI(i).description
_Dest 0
_PutImage (800, 360)-(1260, 699), blankscreen
End If
Print i; Tab(6); Left$(SI(i).title, 25); Tab(33); Left$(SI(i).author, 25); Tab(60); SI(i).tag
Next
Color Red, Black
_PrintString (20, 680), "<P>revious Page <N>ext Page <UP/DOWN> change selection"
End Sub
Sub Load_Sample_Index
Open ".\index.txt" For Input As #1 'The only file we should ever have open, in all honesty.
Do Until EOF(1)
Line Input #1, start$
'If start$ <> "[START ENTRY]" Then Print "ERROR Reading file. Invalid Start Entry Point.": End
Line Input #1, title$
Line Input #1, author$
Line Input #1, tag$
description$ = "": finish$ = ""
Do Until finish$ = "[END ENTRY]"
Line Input #1, finish$
finish$ = _Trim$(finish$)
If finish$ <> "[END ENTRY]" Then description$ = description$ + finish$ + Chr$(13)
Loop
SI(count).title = _Trim$(title$)
SI(count).author = _Trim$(author$)
SI(count).tag = _Trim$(tag$)
SI(count).description = _Trim$(description$)
count = count + 1
Loop
Close
End Sub
Save the replace the other QB64 Sample Showcase.bas file in the archive and then you can compile and see the authors names now.
(08-14-2022, 04:29 PM)Pete Wrote: Do we get to name them? If so, in the spirit of SCREEN 0, I'd name my stuff like...
0 Notepad
0 String math
0 Space invaders
0 Transparent Windows
etc.
Hmm, I wonder where that would appear in the index Brewhhahaha!
Pete
Sure it would, just like the 3d-stuff all shows up in there. I don't see why "0 Notepad" would cause any issues with the index.
Here's what an actual index entry looks like:
Code: (Select All)
[START ENTRY]
3d-balls
Antoni Gual
screensaver, 9 lines
'balls by Antoni Gual agual@eic.ictnet.es
'for Rel's 9 LINER contest at QBASICNEWS.COM 1/2003
'------------------------------------------------------------------------
[END ENTRY]
[start code]
title
author
tag
description from here until
[end code]
The screenshot goes in the same folder as the source file, which is the same as the title.
Just messing with you. Putting a zero in front would rank all my stuff ahead of 3-D balls in the current demo index. I'd call that a "modest" request, but I can't do that with a straight face.
Nice project in all, especially as the forum grows. I might suggest having a way to arrange it by author name as well as appname, or possibly even consider using tags. It depends, I guess, how far you want to take it, or as my old pal Knewbie used to say, there are no such things as finished programs.
Updated the archive in the original post to take advantage of the latest changes.
Author names are now listed on the select screen.
You can now select samples from more than just the first screen.
The internal testing variable which capped samples to 100 has been removed. All 280ish samples are now browsable from the selection screen.
Added detail information for more of the samples -- all of the A's are now completed. (I'll add more of these over time, when I'm just wasting time and not really working on anything else. Formatting isn't the prettiest for these atm, and there's no word wrap or scrolling, but we're still a work in progress and I'm just one poor programmer working on sorting out one thing at a time here. )
Grab the latest version and test things out, and if anyone wants to add something of their own to the lists here, feel free to work them up and post the relevant source code, screenshot, and index information, and I'll add your stuff into the demo as well when I release another version.