Windows or Panels
#1
Before starting on a game I need to know if QB64 is capable of creating multiple (3) display "screens or panels" that can handle scrolling text; not re-sizeable and without GUI borders....

Each panel will need to be able to have text and or graphics directed to them. I am not sure that I am explaining this properly.

This is a sample of the panel sizes....

   
Overall image size is 1024x768.


Top left panel: Graphics and a little text. Top right panel: Graphics and text: Bottom panel: Text only. (this panel may need to be able to scroll... but not too sure)
May your journey be free of incident. Live long and prosper.
Reply
#2
You will have to manage them yourself on a single "SCREEN _NEWIMAGE()". Each "panel" is the LONG return value of "_NEWIMAGE" and then you could manage each one hidden from the user by using "_SOURCE" and "_DEST" statements to assign which screen. "_DEST" is to assign which screen to use for drawing, and "_SOURCE" is usually to use "POINT()" to read colors off the screen. You use "_PUTIMAGE" to put the "panels" into the "main" screen. It sounds complicated but it really isn't, imagine trying to do it all with interpreted QBasic.

P.S. Are you able to use sdlBasic? How?! I'm trying to get it going even on 32-bit "Precise Pangolin" and can't! I only wanted to check out the games. This appeared as package for Mageia 8, couldn't believe it...
Reply
#3
For scrolling text in a section of the screen just use View. So setup Views for different parts of screen?
https://qb64phoenix.com/qb64wiki/index.php/VIEW

Looks like you can direct all the graphics into a View box as well.

I don't know how it'd take to different fonts? I am getting curious enough to experiment if no one else knows.
b = b + ...
Reply
#4
Keep things simple and use monospaced fonts. The "_FONT 8" might be enough but maybe stretch it a bit horizontally, like "WIDTH 40" type. The ancient CRT screens seen in cheesy sci-fi movies all had monospaced fonts... as well as the fake Unix terminal screens in television series seen more recently such as "Blindspot".
Reply
#5
This sounds like my frame library at work.

Code: (Select All)
'$INCLUDE:'FrameLibrary.BI'

CONST FileName$ = "tt.txt"


REDIM SHARED WordGrid(0, 0) AS STRING * 1
REDIM SHARED YLines(0, 0) AS STRING
REDIM SHARED XLines(0, 0) AS STRING

DIM SHARED SearchTerms(1) AS STRING
SearchTerms(0) = "TRICK": SearchTerms(1) = "TREAT"

DIM SHARED X AS INTEGER, Y AS INTEGER

DIM SHARED LeftFrame AS INTEGER, RightFrame AS INTEGER


SCREEN _NEWIMAGE(1280, 720, 32) '720p HD just cause I like it as a standard


LeftFrame = NewTextArea(0, 0, 400, _HEIGHT - 1, False)
ColorTextArea LeftFrame, _RGB32(255, 255, 255), _RGB32(0, 0, 128)
DrawTextArea LeftFrame

RightFrame = NewTextArea(401, 0, _WIDTH - 1, _HEIGHT - 1, False)
ColorTextArea RightFrame, _RGB32(255, 255, 255), _RGB32(0, 0, 0)
DrawTextArea RightFrame



LoadWordGrid
MakeDirectional
ShowGrid
FindWords



SUB FindWords
    FOR j = 0 TO UBOUND(SearchTerms)
        SetPrintStyleX RightFrame, CenterJustify
        SetPrintUpdate RightFrame, NewLine
        SetTextForeground RightFrame, _RGB32(255, 255, 0)
        PrintOut RightFrame, "SEARCHING FOR " + SearchTerms(j)
        SetTextForeground RightFrame, _RGB32(255, 255, 255)
        PrintOut RightFrame, ""
        PrintOut RightFrame, "Finding Left to Right Matches"
        SetPrintStyleX RightFrame, NoJustify
        SetPrintUpdate RightFrame, NoNewLine

        FOR i = 1 TO Y
            foundone = 0
            DO
                foundone = INSTR(foundone + 1, YLines(1, i), SearchTerms(j))
                IF foundone THEN
                    PrintOut RightFrame, "(Line" + STR$(i) + ", Position" + STR$(foundone) + "), "
                    tc = tc + 1
                END IF
            LOOP UNTIL NOT foundone
        NEXT

        SetPrintStyleX RightFrame, CenterJustify
        SetPrintUpdate RightFrame, NewLine
        PrintOut RightFrame, ""
        PrintOut RightFrame, ""
        PrintOut RightFrame, "Finding Right to Left Matches"
        SetPrintUpdate RightFrame, NoNewLine
        SetPrintStyleX RightFrame, NoJustify
        FOR i = 1 TO Y
            foundone = 0
            DO
                foundone = INSTR(foundone + 1, YLines(2, i), SearchTerms(j))
                IF foundone THEN
                    PrintOut RightFrame, "(Line" + STR$(i) + ", Position" + STR$(X - foundone + 1) + "), "
                    tc = tc + 1
                END IF
            LOOP UNTIL NOT foundone
        NEXT

        SetPrintStyleX RightFrame, CenterJustify
        SetPrintUpdate RightFrame, NewLine
        PrintOut RightFrame, ""
        PrintOut RightFrame, ""
        PrintOut RightFrame, "Finding Up to Down Matches"
        SetPrintUpdate RightFrame, NoNewLine
        SetPrintStyleX RightFrame, NoJustify
        FOR i = 1 TO X
            foundone = 0
            DO
                foundone = INSTR(foundone + 1, XLines(1, i), SearchTerms(j))
                IF foundone THEN
                    PrintOut RightFrame, "(Line" + STR$(foundone) + ", Position" + STR$(i) + "), "
                    tc = tc + 1
                END IF
            LOOP UNTIL NOT foundone
        NEXT

        SetPrintStyleX RightFrame, CenterJustify
        SetPrintUpdate RightFrame, NewLine
        PrintOut RightFrame, ""
        PrintOut RightFrame, ""
        PrintOut RightFrame, "Finding Down to Up Matches"
        SetPrintUpdate RightFrame, NoNewLine
        SetPrintStyleX RightFrame, NoJustify
        FOR i = 1 TO X
            foundone = 0
            DO
                foundone = INSTR(foundone + 1, XLines(2, i), SearchTerms(j))
                IF foundone THEN
                    PrintOut RightFrame, "(Line" + STR$(foundone) + ", Position" + STR$(i) + "), "
                    tc = tc + 1
                END IF
            LOOP UNTIL NOT foundone
        NEXT


        SetPrintUpdate RightFrame, NewLine
        PrintOut RightFrame, ""
        PrintOut RightFrame, ""
        PrintOut RightFrame, STR$(tc) + " total matches found."
        PrintOut RightFrame, ""
        PrintOut RightFrame, ""
        tc = 0
    NEXT
END SUB



SUB ShowGrid
    'Print the words in the grid
    SetTextColor LeftFrame, _RGB32(255, 255, 0), 0
    PrintOut LeftFrame, ""
    PrintOut LeftFrame, "                    WORD GRID"
    PrintOut LeftFrame, ""
    SetTextColor LeftFrame, _RGB32(255, 255, 255), 0
    FOR i = 1 TO Y
        PrintOut LeftFrame, "  " + YLines(1, i)
    NEXT
END SUB




SUB LoadWordGrid
    OPEN FileName$ FOR BINARY AS #1
    DO UNTIL EOF(1)
        LINE INPUT #1, junk$
        Y = Y + 1
    LOOP
    X = LEN(junk$): Y = Y
    SEEK #1, 1

    REDIM WordGrid(1 TO X, 1 TO Y) AS STRING * 1 'Properly size our grid, with borders
    REDIM YLines(2, Y) AS STRING
    REDIM XLines(2, X) AS STRING

    FOR i = 1 TO Y
        LINE INPUT #1, junk$
        FOR j = 1 TO X
            WordGrid(j, i) = MID$(junk$, j) 'Fill in the grid with the letters
        NEXT
    NEXT
    CLOSE #1
END SUB

SUB MakeDirectional
    FOR i = 1 TO Y
        FOR j = 1 TO X
            YLines(1, i) = YLines(1, i) + WordGrid(j, i) 'Left to Right Lines
    NEXT j, i
    FOR i = 1 TO Y: FOR j = X TO 1 STEP -1
            YLines(2, i) = YLines(2, i) + WordGrid(j, i) 'Right to Left Lines
    NEXT j, i
    FOR i = 1 TO Y: FOR j = 1 TO X
            XLines(1, i) = XLines(1, i) + WordGrid(j, i) 'Up to Down Lines
    NEXT j, i
    FOR i = 1 TO Y: FOR j = X TO 1 STEP -1
            XLines(2, i) = XLines(1, i) + WordGrid(j, i) 'Right to Left Lines
    NEXT j, i
END SUB

'$INCLUDE:'FrameLibrary.BM'


The demo here sets us up with just 2 frames (leftframe and rightframe here), but there's no reason why you can't have 3 or 12 or 127...

I shared this waaay back on the old *.rip forums, but you can find a copy of the original post on the subject here in you're interested: Frame Library (alephc.xyz)


Attached Files
.bi   FrameLibrary.BI (Size: 900 bytes / Downloads: 83)
.bm   FrameLibrary.BM (Size: 18.79 KB / Downloads: 94)
.txt   tt.txt (Size: 640 bytes / Downloads: 33)
Reply
#6
That looks like old Trick or Treat Word Search thing I did way back...
b = b + ...
Reply
#7
(09-02-2022, 08:49 PM)bplus Wrote: That looks like old Trick or Treat Word Search thing I did way back...

That was from waay back then.  I just adapted my version to the frame library for output.  Wink
Reply
#8
mnrvovrfc,

As you are using Ubuntu 12.04LTS, I seriously doubt that you would be able to install much at all, as the 2012 version of Ubuntu is no longer supported. My recommendation is to install a current version of Ubuntu. Sdlbasic (if memory serves correctly) is still available in the software repository.

If you need any assistance, I would be happy to help, or there is always the sdlbasic forum http://sdlbasic.epizy.com

Regards

J
May your journey be free of incident. Live long and prosper.
Reply
#9
@johnno56 Thank you for your offer. I looked up how to install sdlBasic on Fedora XFCE. I wish I had this with the old Ubuntu Studio, while I didn't have Internet. Otherwise LOL, ten years old, I would rather keep QB64 at this point.
Reply




Users browsing this thread: 2 Guest(s)