Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QB64-PE Sample Showcase
#11
yeah .com, who picked these? Stx I will bet!
b = b + ...
Reply
#12
(08-14-2022, 11:48 PM)dbox Wrote: That looks real similar to the samples page on qb64.com:  https://qb64.com/samples.html

It is.  It's an offline version which you can browse and explore without any internet access.  Wink

From the top of the notes:

'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
Reply
#13
(08-14-2022, 11:51 PM)bplus Wrote: yeah .com, who picked these? Stx I will bet!


Feel free to suggest and add ones of your own.  It's got a simple enough format now, anyone should be able to add to it.  It's all just text fields and LINE INPUT at play.  Wink
Reply
#14
Actually I am very happy with my little corner of this forum, Thank you very much!
b = b + ...
Reply
#15
I resented the preview screens crunched up so I made a modification which looks ugly LOL.
It supports backspace key to toggle between program screen preview and the description.
Also this does only 20 entries in one screen pass, putting the tags on a separate line from program name.

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

CONST LINECURSTEP = 20


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.

DIM descornot AS _BYTE

$COLOR:32
SCREEN _NEWIMAGE(1280, 720, 32)
REDIM SHARED SI(1000) AS Sample_Index_Type, count
_TITLE "QB64-PE Sample Showcase"

Load_Sample_Index
count = count - 1
_DELAY .5
_SCREENMOVE _MIDDLE


descornot = -1
screenchanged = -1
DO
    IF screenchanged THEN
        DisplayScreen start, selected, limit, descornot
        screenchanged = 0
    END IF
    k = _KEYHIT
    SELECT CASE k
        CASE 8
            descornot = NOT descornot
            screenchanged = -1
        CASE 27: SYSTEM
        CASE 18432
            selected = selected - 1: IF selected < 0 THEN selected = LINECURSTEP
            screenchanged = -1
        CASE 20480:
            selected = selected + 1: IF selected > limit THEN selected = 0
            screenchanged = -1
        CASE ASC("N"), ASC("n")
            start = start + LINECURSTEP: IF start > count THEN start = 0
            screenchanged = -1
        CASE ASC("P"), ASC("p"):
            IF start = 0 THEN
                start = count - LINECURSTEP
            ELSE
                start = start - LINECURSTEP: IF start < 0 THEN start = 0
            END IF
            screenchanged = -1
    END SELECT
    _LIMIT 30
    _DISPLAY
LOOP



SUB DisplayScreen (start, selected, limit, toggle AS _BYTE)
    STATIC screenshot, blankscreen, nopreview
    IF blankscreen = 0 THEN blankscreen = _NEWIMAGE(920, 680, 32)
    IF nopreview = 0 THEN nopreview = _LOADIMAGE("nopreview.png", 32)

    finish = start + LINECURSTEP: 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"
    FOR i = start TO finish
        IF i = start + selected THEN
            LINE (0, selected * 32 + 16)-STEP(770, 32), Red, BF
            IF toggle THEN
                IF screenshot <> 0 AND screenshot <> -1 THEN _FREEIMAGE screenshot
                temp$ = "./" + SI(i).title + "/screenshot.png"
                screenshot = _LOADIMAGE(temp$, 32)
                IF screenshot <> -1 THEN
                    _PUTIMAGE (340, 20)-(1259, 699), screenshot
                ELSEIF nopreview <> -1 THEN
                    _PUTIMAGE (340, 20)-(1259, 699), nopreview
                END IF
            ELSE
                _DEST blankscreen
                CLS , Black
                COLOR White, Black
                PRINT SI(i).description
                _DEST 0
                _PUTIMAGE (340, 20)-(1259, 699), blankscreen
            END IF
        END IF
        PRINT i; TAB(6); LEFT$(SI(i).title, 25); TAB(33); LEFT$(SI(i).author, 25)
        PRINT SI(i).tag;
    NEXT
    COLOR Red, Black
    _PRINTSTRING (20, 700), "<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

Took the liberty of creating this file as well:

.zip   nopreview.png.zip (Size: 102.81 KB / Downloads: 57)

Unpack this PNG file, put it in the same directory as the BAS program and its related "screenshot.png".
Reply
#16
Updated the program once again, and you'll need to redownload it from the first post in this topic. What's changed?

1) We now have a pretty little splash screen for an intro to the program.
2) Users can now <R>un a program from the select menu.

NOTE: This requires that the archive is extracted into your QB64 folder, so that it'll find paths and such properly. Your QB64 folder should look something like the following once you've extracted it into the proper place:

[Image: image.png]

NOTE 2: This is still a work in progress. It *ONLY* runs the sample program as long as there is a single BAS file inside the folder so it knows which one to compile and run. Some of the samples rely on multiple EXE files being compiled (such as for a CHAIN example, or one with a TCP/IP localhost example), and those simply get ignored at the moment and won't run at all. (Or do anything really -- not even toss you a nice "these need to be manually compiled" message yet. What can I can say except it's still a work in progress.)

I'll be truly curious for feedback on what we have now, especially from any Linux/Mac folks who might want to point out when/where I may've went wrong with slashes or filename cases, or extensions, or whatnot. I'm no expert on Linux and QB64 -- not by a long shot -- and I honestly don't know if this will work at all for you guys. Does Linux even append a nice .bas or .exe to the filenames for us? If not, then how does it keep track of which is the text file and which is the executable?

Guess I'm going to have to do some more digging into QB64 and Linux/Mac, if I want to say that the Sample Showcase works as it should on them, just as it does on Windows. Wink
Reply
#17
Updated the showcase to now work with full mouse support. There's buttons at the bottom left which you can use to interact with the interface -- just click on them! Mousewheel can also scroll up and down our list of samples.

Changed the layout of the interface a little more, to give more room for descriptions and better author information.

New Showcase can be downloaded from the bottom of the original post in this topic.



What's to do next:

Add Search support so the user can search for a specific author or tag, and limit the results in that manner.

EDIT: (Thanks to a reminder from Rho Sigma) Remember to check if the user has "qb64.exe" or "qb64pe.exe" as their compiler. Also check to see why ESC isn't skipping the initial splash screen as it should.

Copy the rest of the descriptions over from qb64.com for all the files.

Hunt down the original links on the web from where these samples came from. (Shame on the guys who gathered this list originally! One should always attribute *where* they copied stuff from, when copying other people's work! It's just being polite.)

Add more samples to the archives once all else is said and done.



If anyone wants to help with the last few tasks, all you really need to do is open the Index.txt file into your favorite text editor and copy/paste the missing information in the relevant areas. The whole database is set up to be read in a very simple LINE INPUT method, so it doesn't get any simpler than this when editing the information manually. Just post an update of the modified INDEX.txt file here, and I'll merge it into the master archive before I zip it back up and share the next version again. Wink
Reply
#18
(Also updated the screenshot in the first post so that it now looks like the updated screen.)
Reply
#19
Is it too late to submit a sample? What level of polish is required to submit a sample? Is there a size limitation?

I would like to submit my pool game and physics engine samples. They will require a bit of tidying up for cross platform.
Reply
#20
(09-02-2022, 09:33 PM)justsomeguy Wrote: Is it too late to submit a sample? What level of polish is required to submit a sample? Is there a size limitation?

I would like to submit my pool game and physics engine samples. They will require a bit of tidying up for cross platform.

As long as they'll compile into their own subfolder, you should be good to go.  (In other words, all libraries and resource files need to be relational to the compiled EXE and not hard-coded somewhere. Wink )
Reply




Users browsing this thread: 20 Guest(s)